3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -19,7 +19,8 @@
 | 
			
		||||
 | 
			
		||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 | 
			
		||||
hs_err_pid*
 | 
			
		||||
.gradle/4.3.1/
 | 
			
		||||
.gradle
 | 
			
		||||
.idea
 | 
			
		||||
target
 | 
			
		||||
TabooLib.iml
 | 
			
		||||
build
 | 
			
		||||
							
								
								
									
										133
									
								
								TabooLib.iml
									
									
									
									
									
								
							
							
						
						
									
										133
									
								
								TabooLib.iml
									
									
									
									
									
								
							@@ -1,133 +0,0 @@
 | 
			
		||||
 <?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
 | 
			
		||||
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
 | 
			
		||||
    <output url="file://$MODULE_DIR$/target/classes" />
 | 
			
		||||
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
 | 
			
		||||
    <content url="file://$MODULE_DIR$">
 | 
			
		||||
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
 | 
			
		||||
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
 | 
			
		||||
      <excludeFolder url="file://$MODULE_DIR$/target" />
 | 
			
		||||
    </content>
 | 
			
		||||
    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
 | 
			
		||||
    <orderEntry type="sourceFolder" forTests="false" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.cassandra:cassandra-all:0.8.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.google.guava:guava:r08" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: commons-cli:commons-cli:1.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.antlr:antlr:3.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.cassandra.deps:avro:1.4.0-cassandra-1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.mortbay.jetty:jetty:6.1.22" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.mortbay.jetty:jetty-util:6.1.22" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.mortbay.jetty:servlet-api:2.5-20081211" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.4.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.4.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.github.stephenc.high-scale-lib:high-scale-lib:1.1.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.6" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.thrift:libthrift:0.6.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: junit:junit:4.4" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: javax.servlet:servlet-api:2.5" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.0.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.0.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.apache.cassandra:cassandra-thrift:0.8.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.github.stephenc:jamm:0.2.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.1.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.javalite:activejdbc:2.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.javalite:javalite-common:2.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.javalite:app-config:2.0" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.h2database:h2:1.4.197" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: com.ilummc.eagletdl:EagletCore:1.1.2" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: org.ow2.asm:asm:6.1.1" level="project" />
 | 
			
		||||
    <orderEntry type="library" name="Maven: me.clip:placeholderapi:2.8.4" level="project" />
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: bukkit:bukkit1_12:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/1_12_R1.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: bukkit:bukkit1_8:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/1_8_R3.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: com.sun.tools:jshell:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/com.sun.tools.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: taboocode:taboocode:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/TabooCode5.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: yum:yum:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/Yum.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: plib:plib:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/ProtocolLib.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: wg:wg:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/WorldGuard.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: sk:sk:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/Skript.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
    <orderEntry type="module-library">
 | 
			
		||||
      <library name="Maven: vault:vault:1">
 | 
			
		||||
        <CLASSES>
 | 
			
		||||
          <root url="jar://$MODULE_DIR$/libs/Vault.jar!/" />
 | 
			
		||||
        </CLASSES>
 | 
			
		||||
        <JAVADOC />
 | 
			
		||||
        <SOURCES />
 | 
			
		||||
      </library>
 | 
			
		||||
    </orderEntry>
 | 
			
		||||
  </component>
 | 
			
		||||
</module>
 | 
			
		||||
							
								
								
									
										45
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
plugins {
 | 
			
		||||
    id 'java'
 | 
			
		||||
    id 'scala'
 | 
			
		||||
    id 'idea'
 | 
			
		||||
    id 'com.github.johnrengelman.shadow' version '4.0.4'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
group = 'me.skymc'
 | 
			
		||||
version = '4.73'
 | 
			
		||||
 | 
			
		||||
sourceCompatibility = 1.8
 | 
			
		||||
targetCompatibility = 1.8
 | 
			
		||||
 | 
			
		||||
defaultTasks 'build', 'shadowJar'
 | 
			
		||||
 | 
			
		||||
tasks.withType(ScalaCompile) {
 | 
			
		||||
    options.encoding = 'UTF-8'
 | 
			
		||||
    scalaCompileOptions.encoding = 'UTF-8'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
repositories {
 | 
			
		||||
    mavenCentral()
 | 
			
		||||
    maven { url "http://repo.extendedclip.com/content/repositories/placeholderapi/" }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    shadow(group: 'org.apache.cassandra', name: 'cassandra-all', version: '0.8.1') {
 | 
			
		||||
        exclude(module: 'slf4j-log4j12')
 | 
			
		||||
        exclude(module: 'log4j')
 | 
			
		||||
    }
 | 
			
		||||
    compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
 | 
			
		||||
    shadow group: 'com.zaxxer', name: 'HikariCP', version: '3.1.0'
 | 
			
		||||
    shadow group: 'org.javalite', name: 'activejdbc', version: '2.0'
 | 
			
		||||
    shadow group: 'com.h2database', name: 'h2', version: '1.4.197'
 | 
			
		||||
    compile group: 'org.ow2.asm', name: 'asm', version: '6.1.1'
 | 
			
		||||
    shadow group: 'me.clip', name: 'placeholderapi', version: '2.8.4'
 | 
			
		||||
    shadow group: 'net.objecthunter', name: 'exp4j', version: '0.4.8'
 | 
			
		||||
    shadow group: 'org.scala-lang', name: 'scala-library', version: '2.12.8'
 | 
			
		||||
    shadow fileTree(dir: 'libs', includes: ['*.jar'])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shadowJar {
 | 
			
		||||
    // 免得 MANIFEST.MF 里面刷一堆 lib 难看
 | 
			
		||||
    taskActions.removeIf { it.actionClassName.contains 'configureShadowTask' }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
#Sat Mar 02 13:40:08 CST 2019
 | 
			
		||||
distributionBase=GRADLE_USER_HOME
 | 
			
		||||
distributionPath=wrapper/dists
 | 
			
		||||
zipStoreBase=GRADLE_USER_HOME
 | 
			
		||||
zipStorePath=wrapper/dists
 | 
			
		||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
 | 
			
		||||
							
								
								
									
										172
									
								
								gradlew
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								gradlew
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
			
		||||
#!/usr/bin/env sh
 | 
			
		||||
 | 
			
		||||
##############################################################################
 | 
			
		||||
##
 | 
			
		||||
##  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=""
 | 
			
		||||
 | 
			
		||||
# 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, switch paths to Windows format before running java
 | 
			
		||||
if $cygwin ; then
 | 
			
		||||
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
 | 
			
		||||
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
 | 
			
		||||
    JAVACMD=`cygpath --unix "$JAVACMD"`
 | 
			
		||||
 | 
			
		||||
    # We build the pattern for arguments to be converted via cygpath
 | 
			
		||||
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
 | 
			
		||||
    SEP=""
 | 
			
		||||
    for dir in $ROOTDIRSRAW ; do
 | 
			
		||||
        ROOTDIRS="$ROOTDIRS$SEP$dir"
 | 
			
		||||
        SEP="|"
 | 
			
		||||
    done
 | 
			
		||||
    OURCYGPATTERN="(^($ROOTDIRS))"
 | 
			
		||||
    # Add a user-defined pattern to the cygpath arguments
 | 
			
		||||
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
 | 
			
		||||
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
 | 
			
		||||
    fi
 | 
			
		||||
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
 | 
			
		||||
    i=0
 | 
			
		||||
    for arg in "$@" ; do
 | 
			
		||||
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
 | 
			
		||||
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
 | 
			
		||||
 | 
			
		||||
        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
 | 
			
		||||
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
 | 
			
		||||
        else
 | 
			
		||||
            eval `echo args$i`="\"$arg\""
 | 
			
		||||
        fi
 | 
			
		||||
        i=$((i+1))
 | 
			
		||||
    done
 | 
			
		||||
    case $i in
 | 
			
		||||
        (0) set -- ;;
 | 
			
		||||
        (1) set -- "$args0" ;;
 | 
			
		||||
        (2) set -- "$args0" "$args1" ;;
 | 
			
		||||
        (3) set -- "$args0" "$args1" "$args2" ;;
 | 
			
		||||
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
 | 
			
		||||
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
 | 
			
		||||
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
 | 
			
		||||
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
 | 
			
		||||
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
 | 
			
		||||
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Escape application args
 | 
			
		||||
save () {
 | 
			
		||||
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
 | 
			
		||||
    echo " "
 | 
			
		||||
}
 | 
			
		||||
APP_ARGS=$(save "$@")
 | 
			
		||||
 | 
			
		||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
 | 
			
		||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
 | 
			
		||||
 | 
			
		||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
 | 
			
		||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
 | 
			
		||||
  cd "$(dirname "$0")"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
exec "$JAVACMD" "$@"
 | 
			
		||||
							
								
								
									
										84
									
								
								gradlew.bat
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								gradlew.bat
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
@if "%DEBUG%" == "" @echo off
 | 
			
		||||
@rem ##########################################################################
 | 
			
		||||
@rem
 | 
			
		||||
@rem  Gradle startup script for Windows
 | 
			
		||||
@rem
 | 
			
		||||
@rem ##########################################################################
 | 
			
		||||
 | 
			
		||||
@rem Set local scope for the variables with windows NT shell
 | 
			
		||||
if "%OS%"=="Windows_NT" setlocal
 | 
			
		||||
 | 
			
		||||
set DIRNAME=%~dp0
 | 
			
		||||
if "%DIRNAME%" == "" set DIRNAME=.
 | 
			
		||||
set APP_BASE_NAME=%~n0
 | 
			
		||||
set APP_HOME=%DIRNAME%
 | 
			
		||||
 | 
			
		||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 | 
			
		||||
set DEFAULT_JVM_OPTS=
 | 
			
		||||
 | 
			
		||||
@rem Find java.exe
 | 
			
		||||
if defined JAVA_HOME goto findJavaFromJavaHome
 | 
			
		||||
 | 
			
		||||
set JAVA_EXE=java.exe
 | 
			
		||||
%JAVA_EXE% -version >NUL 2>&1
 | 
			
		||||
if "%ERRORLEVEL%" == "0" goto init
 | 
			
		||||
 | 
			
		||||
echo.
 | 
			
		||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
 | 
			
		||||
echo.
 | 
			
		||||
echo Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
echo location of your Java installation.
 | 
			
		||||
 | 
			
		||||
goto fail
 | 
			
		||||
 | 
			
		||||
:findJavaFromJavaHome
 | 
			
		||||
set JAVA_HOME=%JAVA_HOME:"=%
 | 
			
		||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
 | 
			
		||||
 | 
			
		||||
if exist "%JAVA_EXE%" goto init
 | 
			
		||||
 | 
			
		||||
echo.
 | 
			
		||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
 | 
			
		||||
echo.
 | 
			
		||||
echo Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
echo location of your Java installation.
 | 
			
		||||
 | 
			
		||||
goto fail
 | 
			
		||||
 | 
			
		||||
:init
 | 
			
		||||
@rem Get command-line arguments, handling Windows variants
 | 
			
		||||
 | 
			
		||||
if not "%OS%" == "Windows_NT" goto win9xME_args
 | 
			
		||||
 | 
			
		||||
:win9xME_args
 | 
			
		||||
@rem Slurp the command line arguments.
 | 
			
		||||
set CMD_LINE_ARGS=
 | 
			
		||||
set _SKIP=2
 | 
			
		||||
 | 
			
		||||
:win9xME_args_slurp
 | 
			
		||||
if "x%~1" == "x" goto execute
 | 
			
		||||
 | 
			
		||||
set CMD_LINE_ARGS=%*
 | 
			
		||||
 | 
			
		||||
:execute
 | 
			
		||||
@rem Setup the command line
 | 
			
		||||
 | 
			
		||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
 | 
			
		||||
 | 
			
		||||
@rem Execute Gradle
 | 
			
		||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
 | 
			
		||||
 | 
			
		||||
:end
 | 
			
		||||
@rem End local scope for the variables with windows NT shell
 | 
			
		||||
if "%ERRORLEVEL%"=="0" goto mainEnd
 | 
			
		||||
 | 
			
		||||
:fail
 | 
			
		||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
 | 
			
		||||
rem the _cmd.exe /c_ return code!
 | 
			
		||||
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
 | 
			
		||||
exit /b 1
 | 
			
		||||
 | 
			
		||||
:mainEnd
 | 
			
		||||
if "%OS%"=="Windows_NT" endlocal
 | 
			
		||||
 | 
			
		||||
:omega
 | 
			
		||||
							
								
								
									
										263
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										263
									
								
								pom.xml
									
									
									
									
									
								
							@@ -1,263 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
         xmlns="http://maven.apache.org/POM/4.0.0"
 | 
			
		||||
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
    <groupId>me.skymc</groupId>
 | 
			
		||||
    <artifactId>TabooLib</artifactId>
 | 
			
		||||
    <version>4.73</version>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
    </properties>
 | 
			
		||||
    <build>
 | 
			
		||||
        <defaultGoal>clean install package</defaultGoal>
 | 
			
		||||
        <resources>
 | 
			
		||||
            <resource>
 | 
			
		||||
                <directory>src/main/resources</directory>
 | 
			
		||||
                <filtering>true</filtering>
 | 
			
		||||
            </resource>
 | 
			
		||||
        </resources>
 | 
			
		||||
        <sourceDirectory>src/main/java</sourceDirectory>
 | 
			
		||||
        <plugins>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-dependency-plugin</artifactId>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-compiler-plugin</artifactId>
 | 
			
		||||
                <version>3.7.0</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <source>1.8</source>
 | 
			
		||||
                    <target>1.8</target>
 | 
			
		||||
                    <showDeprecation>false</showDeprecation>
 | 
			
		||||
                    <useIncrementalCompilation>true</useIncrementalCompilation>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-resources-plugin</artifactId>
 | 
			
		||||
                <version>3.0.1</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <encoding>UTF-8</encoding>
 | 
			
		||||
                    <useDefaultDelimiters>false</useDefaultDelimiters>
 | 
			
		||||
                    <nonFilteredFileExtensions>
 | 
			
		||||
                        <nonFilteredFileExtension>jar</nonFilteredFileExtension>
 | 
			
		||||
                    </nonFilteredFileExtensions>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>net.alchim31.maven</groupId>
 | 
			
		||||
                <artifactId>scala-maven-plugin</artifactId>
 | 
			
		||||
                <version>3.4.2</version>
 | 
			
		||||
                <!--<executions>-->
 | 
			
		||||
                <!--<execution>-->
 | 
			
		||||
                <!--<phase>compile</phase>-->
 | 
			
		||||
                <!--<goals>-->
 | 
			
		||||
                <!--<goal>compile</goal>-->
 | 
			
		||||
                <!--</goals>-->
 | 
			
		||||
                <!--</execution>-->
 | 
			
		||||
                <!--</executions>-->
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-jar-plugin</artifactId>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <archive>
 | 
			
		||||
                        <manifest>
 | 
			
		||||
                            <mainClass>me.skymc.taboolib.socket.TabooLibServer</mainClass>
 | 
			
		||||
                        </manifest>
 | 
			
		||||
                    </archive>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-shade-plugin</artifactId>
 | 
			
		||||
                <version>3.0.0</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <phase>package</phase>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>shade</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                        <configuration>
 | 
			
		||||
                            <artifactSet>
 | 
			
		||||
                                <includes>
 | 
			
		||||
                                    <include>com.ilummc.eagletdl</include>
 | 
			
		||||
                                    <include>org.ow2.asm</include>
 | 
			
		||||
                                    <include>com.google.code.gson</include>
 | 
			
		||||
                                    <include>net.objecthunter</include>
 | 
			
		||||
                                </includes>
 | 
			
		||||
                            </artifactSet>
 | 
			
		||||
                            <createDependencyReducedPom>false</createDependencyReducedPom>
 | 
			
		||||
                        </configuration>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
        </plugins>
 | 
			
		||||
    </build>
 | 
			
		||||
    <repositories>
 | 
			
		||||
        <repository>
 | 
			
		||||
            <id>placeholderapi</id>
 | 
			
		||||
            <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
 | 
			
		||||
        </repository>
 | 
			
		||||
    </repositories>
 | 
			
		||||
    <dependencies>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.apache.cassandra</groupId>
 | 
			
		||||
            <artifactId>cassandra-all</artifactId>
 | 
			
		||||
            <version>0.8.1</version>
 | 
			
		||||
            <exclusions>
 | 
			
		||||
                <exclusion>
 | 
			
		||||
                    <groupId>org.slf4j</groupId>
 | 
			
		||||
                    <artifactId>slf4j-log4j12</artifactId>
 | 
			
		||||
                </exclusion>
 | 
			
		||||
                <exclusion>
 | 
			
		||||
                    <groupId>log4j</groupId>
 | 
			
		||||
                    <artifactId>log4j</artifactId>
 | 
			
		||||
                </exclusion>
 | 
			
		||||
            </exclusions>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.google.code.gson</groupId>
 | 
			
		||||
            <artifactId>gson</artifactId>
 | 
			
		||||
            <version>2.7</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.zaxxer</groupId>
 | 
			
		||||
            <artifactId>HikariCP</artifactId>
 | 
			
		||||
            <version>3.1.0</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.javalite</groupId>
 | 
			
		||||
            <artifactId>activejdbc</artifactId>
 | 
			
		||||
            <version>2.0</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.h2database</groupId>
 | 
			
		||||
            <artifactId>h2</artifactId>
 | 
			
		||||
            <version>1.4.197</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.ow2.asm</groupId>
 | 
			
		||||
            <artifactId>asm</artifactId>
 | 
			
		||||
            <version>6.1.1</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>me.clip</groupId>
 | 
			
		||||
            <artifactId>placeholderapi</artifactId>
 | 
			
		||||
            <version>2.8.4</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.scala-lang</groupId>
 | 
			
		||||
            <artifactId>scala-library</artifactId>
 | 
			
		||||
            <version>2.12.7</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>net.objecthunter</groupId>
 | 
			
		||||
            <artifactId>exp4j</artifactId>
 | 
			
		||||
            <version>0.4.8</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>bukkit</groupId>
 | 
			
		||||
            <artifactId>bukkit1_12</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/1_12_R1.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>bukkit</groupId>
 | 
			
		||||
            <artifactId>bukkit1_8</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/1_8_R3.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>bungeecord</groupId>
 | 
			
		||||
            <artifactId>bungeecord</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/BungeeCord.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.sun.tools</groupId>
 | 
			
		||||
            <artifactId>jshell</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/com.sun.tools.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>taboocode</groupId>
 | 
			
		||||
            <artifactId>taboocode</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/TabooCode5.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>yum</groupId>
 | 
			
		||||
            <artifactId>yum</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/Yum.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>plib</groupId>
 | 
			
		||||
            <artifactId>plib</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/ProtocolLib.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>wg</groupId>
 | 
			
		||||
            <artifactId>wg</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/WorldGuard.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>sk</groupId>
 | 
			
		||||
            <artifactId>sk</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/Skript.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>vault</groupId>
 | 
			
		||||
            <artifactId>vault</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/Vault.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>bossbar</groupId>
 | 
			
		||||
            <artifactId>bossbar</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/BossBarAPI.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>viaversion</groupId>
 | 
			
		||||
            <artifactId>viaversion</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/ViaVersion.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>protocolsupport</groupId>
 | 
			
		||||
            <artifactId>protocolsupport</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/ProtocolSupport.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>deprecated</groupId>
 | 
			
		||||
            <artifactId>deprecated</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/TabooLibDeprecated.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										1
									
								
								settings.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								settings.gradle
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
rootProject.name = 'TabooLib'
 | 
			
		||||
@@ -1,514 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2009-2018 Igor Polevoy
 | 
			
		||||
 | 
			
		||||
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.javalite.activejdbc;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
import org.javalite.activejdbc.annotations.*;
 | 
			
		||||
import org.javalite.activejdbc.associations.Many2ManyAssociation;
 | 
			
		||||
import org.javalite.activejdbc.associations.OneToManyAssociation;
 | 
			
		||||
import org.javalite.activejdbc.associations.OneToManyPolymorphicAssociation;
 | 
			
		||||
import org.javalite.activejdbc.dialects.Dialect;
 | 
			
		||||
import org.javalite.activejdbc.logging.LogFilter;
 | 
			
		||||
import org.javalite.activejdbc.logging.LogLevel;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
import static org.javalite.common.Inflector.singularize;
 | 
			
		||||
import static org.javalite.common.Inflector.tableize;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class MetaModel implements Serializable {
 | 
			
		||||
    private static final Logger LOGGER = LoggerFactory.getLogger(MetaModel.class);
 | 
			
		||||
    private static final ThreadLocal<HashMap<Class, String>> shardingTableNamesTL = new ThreadLocal<>();
 | 
			
		||||
    private final List<Association> associations = new ArrayList<>();
 | 
			
		||||
    private final String idName;
 | 
			
		||||
    private final String[] compositeKeys;
 | 
			
		||||
    private final String tableName, dbType, dbName;
 | 
			
		||||
    private final Class<? extends Model> modelClass;
 | 
			
		||||
    private final boolean cached;
 | 
			
		||||
    private final String idGeneratorCode;
 | 
			
		||||
    private final String versionColumn;
 | 
			
		||||
    private Map<String, ColumnMetadata> columnMetadata;
 | 
			
		||||
    private Set<String> attributeNamesNoId;
 | 
			
		||||
    private String[] partitionIDs = null;
 | 
			
		||||
 | 
			
		||||
    protected MetaModel(String dbName, Class<? extends Model> modelClass, String dbType) {
 | 
			
		||||
        this.modelClass = modelClass;
 | 
			
		||||
        this.idName = findIdName(modelClass);
 | 
			
		||||
        this.compositeKeys = findCompositeKeys(modelClass);
 | 
			
		||||
        this.tableName = findTableName(modelClass);
 | 
			
		||||
        this.dbType = dbType;
 | 
			
		||||
        this.cached = isCached(modelClass);
 | 
			
		||||
        this.dbName = dbName;
 | 
			
		||||
        this.idGeneratorCode = findIdGeneratorCode(modelClass);
 | 
			
		||||
        this.versionColumn = findVersionColumn(modelClass);
 | 
			
		||||
        this.partitionIDs = findPartitionIDs();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static Map<Class, String> getTableNamesMap() {
 | 
			
		||||
        if (shardingTableNamesTL.get() == null) {
 | 
			
		||||
            shardingTableNamesTL.set(new HashMap<>());
 | 
			
		||||
        }
 | 
			
		||||
        return shardingTableNamesTL.get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected static String getDbName(Class<? extends Model> modelClass) {
 | 
			
		||||
        DbName dbNameAnnotation = modelClass.getAnnotation(DbName.class);
 | 
			
		||||
        return dbNameAnnotation == null ? DB.DEFAULT_NAME : dbNameAnnotation.value();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String[] findPartitionIDs() {
 | 
			
		||||
        PartitionIDs partitionIDs = modelClass.getAnnotation(PartitionIDs.class);
 | 
			
		||||
        return partitionIDs != null ? partitionIDs.value() : null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean hasPartitionIDs() {
 | 
			
		||||
        return partitionIDs != null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String[] getPartitionIDs() {
 | 
			
		||||
        return partitionIDs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * <p>
 | 
			
		||||
     * <strong>This feature is for sharding!</strong>
 | 
			
		||||
     * <br>
 | 
			
		||||
     * Do not use it to set table names <em>willy-nilly</em>!
 | 
			
		||||
     * </p>
 | 
			
		||||
     *
 | 
			
		||||
     * <p>
 | 
			
		||||
     * Sets a table name for this model. The table name is attached to a current thread and will remain there
 | 
			
		||||
     * until it is set with a different value or cleared with {@link #clearShardTableName()} method.
 | 
			
		||||
     * Table name set with this method overrides a table name naturally mapped to this model.
 | 
			
		||||
     * </p>
 | 
			
		||||
     * <p>
 | 
			
		||||
     * Method {@link #getTableName()} will return this value for all operations related to this table.
 | 
			
		||||
     * </p>
 | 
			
		||||
     *
 | 
			
		||||
     * @param tableName name of a table this model will read from current thread.
 | 
			
		||||
     */
 | 
			
		||||
    public void setShardTableName(String tableName) {
 | 
			
		||||
        getTableNamesMap().put(modelClass, tableName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Clears sharding name of table attached to current thread.
 | 
			
		||||
     * The name was supposedly attached by the {@link #setShardTableName(String)}
 | 
			
		||||
     * method. After execution of this class, the method {@link #getTableName()} will be
 | 
			
		||||
     * returning the value this {@link MetaModel} was initialized with during teh bootstrap phase.
 | 
			
		||||
     */
 | 
			
		||||
    public void clearShardTableName() {
 | 
			
		||||
        getTableNamesMap().remove(modelClass);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean isCached(Class<? extends Model> modelClass) {
 | 
			
		||||
        return null != modelClass.getAnnotation(Cached.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String findIdName(Class<? extends Model> modelClass) {
 | 
			
		||||
        IdName idNameAnnotation = modelClass.getAnnotation(IdName.class);
 | 
			
		||||
        return idNameAnnotation == null ? "id" : idNameAnnotation.value();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String[] findCompositeKeys(Class<? extends Model> modelClass) {
 | 
			
		||||
        CompositePK compositeKeysAnnotation = modelClass.getAnnotation(CompositePK.class);
 | 
			
		||||
        return compositeKeysAnnotation == null ? null : compositeKeysAnnotation.value();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Table name with plugin name prefix
 | 
			
		||||
     *
 | 
			
		||||
     * @return table name
 | 
			
		||||
     */
 | 
			
		||||
    private String findTableName(Class<? extends Model> modelClass) {
 | 
			
		||||
        Table tableAnnotation = modelClass.getAnnotation(Table.class);
 | 
			
		||||
        String prefix = "";
 | 
			
		||||
        try {
 | 
			
		||||
            Field field = modelClass.getClassLoader().getClass().getDeclaredField("plugin");
 | 
			
		||||
            field.setAccessible(true);
 | 
			
		||||
            Plugin plugin = (Plugin) field.get(modelClass.getClassLoader());
 | 
			
		||||
            prefix = tableize(plugin.getName()) + "_";
 | 
			
		||||
        } catch (Throwable ignored) {
 | 
			
		||||
        }
 | 
			
		||||
        return prefix + (tableAnnotation == null ? tableize(modelClass.getSimpleName()) : tableAnnotation.value());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String findIdGeneratorCode(Class<? extends Model> modelClass) {
 | 
			
		||||
        IdGenerator idGenerator = modelClass.getAnnotation(IdGenerator.class);
 | 
			
		||||
        return idGenerator == null ? null : idGenerator.value();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String findVersionColumn(Class<? extends Model> modelClass) {
 | 
			
		||||
        VersionColumn vc = modelClass.getAnnotation(VersionColumn.class);
 | 
			
		||||
        return vc == null ? "record_version" : vc.value();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return name of the column for optimistic locking record version
 | 
			
		||||
     */
 | 
			
		||||
    public String getVersionColumn() {
 | 
			
		||||
        return versionColumn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getIdGeneratorCode() {
 | 
			
		||||
        return idGeneratorCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getDbName() {
 | 
			
		||||
        return dbName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean cached() {
 | 
			
		||||
        return cached;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Class<? extends Model> getModelClass() {
 | 
			
		||||
        return modelClass;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns table name currently associated with this model.
 | 
			
		||||
     * Table name can be modified for sharding using {@link #setShardTableName(String)}
 | 
			
		||||
     *
 | 
			
		||||
     * @return table name currently associated with this model.
 | 
			
		||||
     */
 | 
			
		||||
    public String getTableName() {
 | 
			
		||||
        return getTableNamesMap().getOrDefault(modelClass, tableName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected boolean tableExists() {
 | 
			
		||||
        return columnMetadata != null && columnMetadata.isEmpty();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds all attribute names except for id.
 | 
			
		||||
     *
 | 
			
		||||
     * @return all attribute names except for id.
 | 
			
		||||
     */
 | 
			
		||||
    public Set<String> getAttributeNamesSkipId() {
 | 
			
		||||
        if (attributeNamesNoId == null) {//no one cares about unfortunate multi-threading timing with 2 instances created
 | 
			
		||||
            //if someone does, use DCL with volatile
 | 
			
		||||
            Set<String> attributesNames = new CaseInsensitiveSet(getAttributeNames());
 | 
			
		||||
            attributesNames.remove(getIdName());
 | 
			
		||||
            attributeNamesNoId = attributesNames;
 | 
			
		||||
        }
 | 
			
		||||
        return attributeNamesNoId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convenience method. Calls {@link #getAttributeNamesSkipGenerated(boolean)} and passes <code>true</code> as argument.
 | 
			
		||||
     *
 | 
			
		||||
     * @return list of all attributes except id, created_at, updated_at and record_version.
 | 
			
		||||
     */
 | 
			
		||||
    public Set<String> getAttributeNamesSkipGenerated() {
 | 
			
		||||
        return getAttributeNamesSkipGenerated(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds all attribute names except managed like <code>id</code>,
 | 
			
		||||
     * <code>created_at</code>, <code>updated_at</code> and <code>record_version</code>, depending on argument.
 | 
			
		||||
     *
 | 
			
		||||
     * @param managed if true, time managed attributes <code>created_at</code> and <code>updated_at</code> will not be included (they are managed automatically).
 | 
			
		||||
     *                If false (not managed) <code>created_at</code> and <code>updated_at</code> will be included in output.
 | 
			
		||||
     * @return list of all attributes except <code>id</code>, <code>created_at</code>, <code>updated_at</code> and
 | 
			
		||||
     * <code>record_version</code>, depending on argument.
 | 
			
		||||
     */
 | 
			
		||||
    public Set<String> getAttributeNamesSkipGenerated(boolean managed) {
 | 
			
		||||
        //TODO: can cache this, but will need a cache for managed=true an another for managed=false
 | 
			
		||||
        Set<String> attributesNames = new CaseInsensitiveSet(getAttributeNamesSkipId());
 | 
			
		||||
 | 
			
		||||
        if (managed) {
 | 
			
		||||
            attributesNames.remove("created_at");
 | 
			
		||||
            attributesNames.remove("updated_at");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        attributesNames.remove(versionColumn);
 | 
			
		||||
        return attributesNames;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds all attribute names except those provided as arguments.
 | 
			
		||||
     *
 | 
			
		||||
     * @return list of all attributes except those provided as arguments.
 | 
			
		||||
     */
 | 
			
		||||
    public Set<String> getAttributeNamesSkip(String... names) {
 | 
			
		||||
        Set<String> attributes = new CaseInsensitiveSet(getAttributeNames());
 | 
			
		||||
        for (String name : names) {
 | 
			
		||||
            attributes.remove(name);
 | 
			
		||||
        }
 | 
			
		||||
        return attributes;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns true if this model supports optimistic locking, false if not
 | 
			
		||||
     *
 | 
			
		||||
     * @return true if this model supports optimistic locking, false if not
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isVersioned() {
 | 
			
		||||
        return columnMetadata != null && columnMetadata.containsKey(versionColumn);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Retrieves all attribute names.
 | 
			
		||||
     *
 | 
			
		||||
     * @return all attribute names.
 | 
			
		||||
     */
 | 
			
		||||
    protected Set<String> getAttributeNames() {
 | 
			
		||||
        if (columnMetadata == null || columnMetadata.isEmpty()) {
 | 
			
		||||
            throw new InitException("Failed to find table: " + getTableName());
 | 
			
		||||
        }
 | 
			
		||||
        return Collections.unmodifiableSet(columnMetadata.keySet());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getIdName() {
 | 
			
		||||
        return idName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns optional composite primary key class
 | 
			
		||||
     *
 | 
			
		||||
     * @return composite primary key class
 | 
			
		||||
     */
 | 
			
		||||
    public String[] getCompositeKeys() {
 | 
			
		||||
        return compositeKeys;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns association of this table with the target table. Will return null if there is no association.
 | 
			
		||||
     *
 | 
			
		||||
     * @param targetModelClass association of this model and the target model.
 | 
			
		||||
     * @param associationClass class of association in requested.
 | 
			
		||||
     * @return association of this table with the target table. Will return null if there is no association with target
 | 
			
		||||
     * table and specified type.
 | 
			
		||||
     */
 | 
			
		||||
    public <A extends Association> A getAssociationForTarget(Class<? extends Model> targetModelClass, Class<A> associationClass) {
 | 
			
		||||
        Association result = null;
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getClass().equals(associationClass) && association.getTargetClass().equals(targetModelClass)) {
 | 
			
		||||
                result = association;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return (A) result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns association of this table with the target table. Will return null if there is no association.
 | 
			
		||||
     *
 | 
			
		||||
     * @param targetClass association of this model and the target model.
 | 
			
		||||
     * @return association of this table with the target table. Will return null if there is no association with target
 | 
			
		||||
     * table and specified type.
 | 
			
		||||
     */
 | 
			
		||||
    public <A extends Association> A getAssociationForTarget(Class<? extends Model> targetClass) {
 | 
			
		||||
        Association result = null;
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getTargetClass().equals(targetClass)) {
 | 
			
		||||
                result = association;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return (A) result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns associations of this table with the target table. It is possible
 | 
			
		||||
     * to have more than one association to a target table if a target table is the same as source. Usually this
 | 
			
		||||
     * happens when tree structures are stored in the same table (category has many categories).
 | 
			
		||||
     *
 | 
			
		||||
     * @param targetModelClass association of this model and the target model.
 | 
			
		||||
     * @return list of associations of this table with the target table. Will return empty list if none found.
 | 
			
		||||
     * table and specified type.
 | 
			
		||||
     */
 | 
			
		||||
    public List<Association> getAssociationsForTarget(Class<? extends Model> targetModelClass) {
 | 
			
		||||
        List<Association> result = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getTargetClass().equals(targetModelClass)) {
 | 
			
		||||
                result.add(association);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void addAssociation(Association association) {
 | 
			
		||||
        if (!associations.contains(association)) {
 | 
			
		||||
            LogFilter.log(LOGGER, LogLevel.INFO, "Association found: {}", association);
 | 
			
		||||
            associations.add(association);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * returns true if this attribute is present in this meta model. This method i case insensitive.
 | 
			
		||||
     *
 | 
			
		||||
     * @param attribute attribute name, case insensitive.
 | 
			
		||||
     * @return true if this attribute is present in this meta model, false of not.
 | 
			
		||||
     */
 | 
			
		||||
    boolean hasAttribute(String attribute) {
 | 
			
		||||
        if (columnMetadata != null) {
 | 
			
		||||
            if (columnMetadata.containsKey(attribute)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            } else if (attribute.startsWith("\"") && attribute.endsWith("\"")) {
 | 
			
		||||
                return columnMetadata.containsKey(attribute.substring(1, attribute.length() - 1));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected boolean hasAssociation(Class<? extends Model> targetClass, Class<? extends Association> associationClass) {
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getTargetClass().equals(targetClass) &&
 | 
			
		||||
                    association.getClass().equals(associationClass)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        final StringBuilder t = new StringBuilder();
 | 
			
		||||
        t.append("MetaModel: ").append(tableName).append(", ").append(modelClass).append("\n");
 | 
			
		||||
        if (columnMetadata != null) {
 | 
			
		||||
            for (Entry<String, ColumnMetadata> metadata : columnMetadata.entrySet()) {
 | 
			
		||||
                t.append(metadata.getValue()).append(", ");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return t.toString();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * FK name is a foreign key name used in relationships as a foreign key column in a child table (table represented by this
 | 
			
		||||
     * instance is a parent table).
 | 
			
		||||
     * The FK name is derived using {@link org.javalite.common.Inflector}: It is a singular version of this table name plus "_id".
 | 
			
		||||
     *
 | 
			
		||||
     * @return foreign key name used in relationships as a foreign key column in a child table.
 | 
			
		||||
     */
 | 
			
		||||
    public String getFKName() {
 | 
			
		||||
        return singularize(getTableName()).toLowerCase() + "_id";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected List<OneToManyAssociation> getOneToManyAssociations(List<Association> exclusions) {
 | 
			
		||||
        List<OneToManyAssociation> one2Manies = new ArrayList<>();
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getClass().equals(OneToManyAssociation.class) && !exclusions.contains(association)) {
 | 
			
		||||
                one2Manies.add((OneToManyAssociation) association);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return one2Manies;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected List<OneToManyPolymorphicAssociation> getPolymorphicAssociations(List<Association> exclusions) {
 | 
			
		||||
        List<OneToManyPolymorphicAssociation> one2Manies = new ArrayList<>();
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getClass().equals(OneToManyPolymorphicAssociation.class) && !exclusions.contains(association)) {
 | 
			
		||||
                one2Manies.add((OneToManyPolymorphicAssociation) association);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return one2Manies;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected List<Many2ManyAssociation> getManyToManyAssociations(List<Association> excludedAssociations) {
 | 
			
		||||
        List<Many2ManyAssociation> many2Manies = new ArrayList<>();
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getClass().equals(Many2ManyAssociation.class) && !excludedAssociations.contains(association)) {
 | 
			
		||||
                many2Manies.add((Many2ManyAssociation) association);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return many2Manies;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getDbType() {
 | 
			
		||||
        return dbType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Dialect getDialect() {
 | 
			
		||||
        return Registry.instance().getConfiguration().getDialect(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected List<Association> getAssociations() {
 | 
			
		||||
        return Collections.unmodifiableList(associations);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if this model has a named attribute that has the same name as argument.
 | 
			
		||||
     * <p>
 | 
			
		||||
     * Throws <code>IllegalArgumentException</code> in case it does not find it.
 | 
			
		||||
     *
 | 
			
		||||
     * @param attribute name  of attribute or association target.
 | 
			
		||||
     */
 | 
			
		||||
    protected void checkAttribute(String attribute) {
 | 
			
		||||
        if (!hasAttribute(attribute)) {
 | 
			
		||||
            String sb = "Attribute: '" + attribute + "' is not defined in model: '" + getModelClass() + ". "
 | 
			
		||||
                    + "Available attributes: " + getAttributeNames();
 | 
			
		||||
            throw new IllegalArgumentException(sb);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Provides column metadata map, keyed by attribute names.
 | 
			
		||||
     * Table columns correspond to ActiveJDBC model attributes.
 | 
			
		||||
     *
 | 
			
		||||
     * @return Provides column metadata map, keyed by attribute names.
 | 
			
		||||
     */
 | 
			
		||||
    public Map<String, ColumnMetadata> getColumnMetadata() {
 | 
			
		||||
        if (columnMetadata == null || columnMetadata.isEmpty()) {
 | 
			
		||||
            throw new InitException("Failed to find table: " + getTableName());
 | 
			
		||||
        }
 | 
			
		||||
        return Collections.unmodifiableMap(columnMetadata);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void setColumnMetadata(Map<String, ColumnMetadata> columnMetadata) {
 | 
			
		||||
        this.columnMetadata = columnMetadata;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if there is association to the target model class.,
 | 
			
		||||
     *
 | 
			
		||||
     * @param targetModelClass class of a model that will be checked for association from current model.
 | 
			
		||||
     * @return true if any association exists such that the current model is a source and targetModelClass is a target.
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isAssociatedTo(Class<? extends Model> targetModelClass) {
 | 
			
		||||
 | 
			
		||||
        if (targetModelClass == null) {
 | 
			
		||||
            throw new NullPointerException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (Association association : associations) {
 | 
			
		||||
            if (association.getTargetClass().equals(targetModelClass)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeAssociationForTarget(Class<? extends Model> modelClass) {
 | 
			
		||||
        Association association = getAssociationForTarget(modelClass);
 | 
			
		||||
        if (association != null) {
 | 
			
		||||
            associations.remove(association);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import org.bukkit.plugin.Plugin
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import com.ilummc.tlib.scala.Prelude._
 | 
			
		||||
import Prelude._
 | 
			
		||||
import org.bukkit.Material
 | 
			
		||||
import org.bukkit.event.player.PlayerJoinEvent
 | 
			
		||||
import org.bukkit.event.{EventHandler, Listener}
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import com.ilummc.tlib.scala.runtime.{RichLocation, RichOfflinePlayer, RichPlayer, RichVector}
 | 
			
		||||
import com.ilummc.tlibscala.runtime.{RichLocation, RichOfflinePlayer, RichPlayer, RichVector}
 | 
			
		||||
import org.bukkit.entity.Player
 | 
			
		||||
import org.bukkit.util.Vector
 | 
			
		||||
import org.bukkit.{Location, OfflinePlayer, World, util}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import com.ilummc.tlib.resources.TLocale.Logger
 | 
			
		||||
import org.bukkit.Bukkit
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import org.bukkit.scheduler.BukkitRunnable
 | 
			
		||||
 | 
			
		||||
private[scala] class ScalaTaskExecutor(task: => Any) extends BukkitRunnable {
 | 
			
		||||
private[tlibscala] class ScalaTaskExecutor(task: => Any) extends BukkitRunnable {
 | 
			
		||||
 | 
			
		||||
  override def run(): Unit = {
 | 
			
		||||
    try task catch {
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.ilummc.tlib.scala
 | 
			
		||||
package com.ilummc.tlibscala
 | 
			
		||||
 | 
			
		||||
import org.bukkit.plugin.Plugin
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.ilummc.tlib.scala.runtime
 | 
			
		||||
package com.ilummc.tlibscala.runtime
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Location
 | 
			
		||||
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user