mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-02-07 07:11:25 +01:00
Merge branch 'development'
This commit is contained in:
commit
b70d532d3e
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
@ -32,4 +34,5 @@ hs_err_pid*
|
||||
.project
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
.classpath
|
||||
/target/
|
||||
|
@ -1,22 +1,21 @@
|
||||
image: gradle:alpine
|
||||
|
||||
variables:
|
||||
name: "FabledSkyBlock"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "2.1.0"
|
||||
|
||||
before_script:
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
||||
variables:
|
||||
name: "FabledSkyblock"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "2.1.1"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
image: maven:3.5.3-jdk-8
|
||||
script:
|
||||
- find $path/ -type f -name "*.gradle" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
|
||||
- gradle build
|
||||
- mv $path/build/libs/*.jar $path/
|
||||
- find $path/ -type f -name "*.xml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
|
||||
- find $path/ -type f -name "*.yml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
|
||||
- mvn clean package
|
||||
- find $path/ -depth -path '*original*' -delete
|
||||
- mv $path/target/*.jar $path/
|
||||
artifacts:
|
||||
name: $name-$version
|
||||
paths:
|
||||
- $path/*.jar
|
||||
- "$path/*.jar"
|
||||
|
109
build.gradle
109
build.gradle
@ -1,109 +0,0 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
allprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
group = 'com.songoda.skyblock'
|
||||
version = 'maven-version-number'
|
||||
}
|
||||
|
||||
configurations {
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
|
||||
//Spigot
|
||||
maven {
|
||||
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
|
||||
}
|
||||
|
||||
// Bungeecord
|
||||
maven {
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
|
||||
// Songoda
|
||||
maven {
|
||||
url 'http://repo.songoda.com/artifactory/private'
|
||||
}
|
||||
|
||||
// Mojang
|
||||
maven {
|
||||
url 'https://libraries.minecraft.net/'
|
||||
}
|
||||
|
||||
//Jitpack
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// Spigot
|
||||
implementation (group: 'org.spigotmc', name: 'spigot-api', version: '1.14.4-R0.1-SNAPSHOT')
|
||||
|
||||
// GameProfile's Mojang
|
||||
implementation (group: 'com.mojang', name: 'authlib', version: '1.5.3')
|
||||
|
||||
// PlaceholderAPI
|
||||
implementation (group: 'be.maximvdw', name: 'placeholderapi', version: '2.5.1')
|
||||
implementation (group: 'me.clip', name: 'placeholderapi', version: '2.10.2')
|
||||
|
||||
// Vault
|
||||
implementation (group: 'net.milkbowl', name: 'vault', version: '1.7.1')
|
||||
|
||||
// Reserve
|
||||
implementation (group: 'net.tnemc', name: 'Reserve', version: '0.1.3.0')
|
||||
|
||||
// Leaderheads
|
||||
implementation (group: 'me.robin', name: 'leaderheads', version: '1.0')
|
||||
|
||||
// EpicSpawners
|
||||
implementation (group: 'com.songoda', name: 'epicspawners', version: '6-pre4')
|
||||
|
||||
// EpicAnchors
|
||||
implementation (group: 'com.songoda', name: 'EpicAnchors', version: '1.4.2')
|
||||
|
||||
// UltimateStacker
|
||||
implementation (group: 'com.songoda', name: 'ultimatestacker', version: '1.3.1')
|
||||
|
||||
// WildStacker
|
||||
implementation (group: 'com.github.OmerBenGera', name: 'WildStackerAPI', version: 'b15')
|
||||
|
||||
// WorldEdit
|
||||
implementation (group: 'com.sk89q', name: 'worldedit', version: '7.0.0')
|
||||
|
||||
// Apache Commons
|
||||
shade (group: 'org.apache.commons', name: 'commons-lang3', version: '3.0')
|
||||
shade (group: 'commons-io', name: 'commons-io', version: '2.5')
|
||||
|
||||
// JSON.org
|
||||
shade (group: 'org.json', name: 'json', version: '20190722')
|
||||
|
||||
// Songoda Updater
|
||||
shade (group: 'com.songoda', name: 'songodaupdater', version: '1')
|
||||
|
||||
shade fileTree(dir: 'libraries', include: '*.jar')
|
||||
|
||||
}
|
||||
|
||||
processResources {
|
||||
filter ReplaceTokens, tokens: ["version": project.property("version")]
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
include '**/*.yml'
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
configurations.shade.each { dep ->
|
||||
from(project.zipTree(dep)){
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
exclude '**/*.yml'
|
||||
}
|
||||
}
|
||||
}
|
191
dependency-reduced-pom.xml
Normal file
191
dependency-reduced-pom.xml
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>maven-version-number</version>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>FabledSkyblock-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvdw-software</id>
|
||||
<name>MVdW Public Repositories</name>
|
||||
<url>http://repo.mvdw-software.be/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>reserve-repo</id>
|
||||
<url>https://dl.bintray.com/theneweconomy/java/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>private</id>
|
||||
<url>https://repo.songoda.com/artifactory/private/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.15.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>gson</artifactId>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>org.bukkit</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.tnemc</groupId>
|
||||
<artifactId>Reserve</artifactId>
|
||||
<version>0.1.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.robin</groupId>
|
||||
<artifactId>leaderheads</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>epicspawners</artifactId>
|
||||
<version>6-pre4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>EpicAnchors</artifactId>
|
||||
<version>1.4.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>ultimatestacker</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.OmerBenGera</groupId>
|
||||
<artifactId>WildStackerAPI</artifactId>
|
||||
<version>b15</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
<version>7.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>gson</artifactId>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
188
gradlew
vendored
188
gradlew
vendored
@ -1,188 +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
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## 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, 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" "$@"
|
100
gradlew.bat
vendored
100
gradlew.bat
vendored
@ -1,100 +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 http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
Binary file not shown.
179
pom.xml
Normal file
179
pom.xml
Normal file
@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>maven-version-number</version>
|
||||
<build>
|
||||
<finalName>FabledSkyblock-${project.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration />
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvdw-software</id>
|
||||
<name>MVdW Public Repositories</name>
|
||||
<url>http://repo.mvdw-software.be/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>reserve-repo</id>
|
||||
<url>https://dl.bintray.com/theneweconomy/java/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>private</id>
|
||||
<url>https://repo.songoda.com/artifactory/private/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.15.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>be.maximvdw</groupId>
|
||||
<artifactId>MVdWPlaceholderAPI</artifactId>
|
||||
<version>2.1.1-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.tnemc</groupId>
|
||||
<artifactId>Reserve</artifactId>
|
||||
<version>0.1.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.robin</groupId>
|
||||
<artifactId>leaderheads</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>epicspawners</artifactId>
|
||||
<version>6-pre4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>EpicAnchors</artifactId>
|
||||
<version>1.4.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>ultimatestacker</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.OmerBenGera</groupId>
|
||||
<artifactId>WildStackerAPI</artifactId>
|
||||
<version>b15</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
<version>7.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20190722</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>songodaupdater</artifactId>
|
||||
<version>1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1 +0,0 @@
|
||||
rootProject.name = 'FabledSkyblock'
|
@ -1,5 +1,15 @@
|
||||
package com.songoda.skyblock;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.songoda.skyblock.api.SkyBlockAPI;
|
||||
import com.songoda.skyblock.ban.BanManager;
|
||||
import com.songoda.skyblock.biome.BiomeManager;
|
||||
@ -16,7 +26,28 @@ import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.leaderboard.LeaderboardManager;
|
||||
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
|
||||
import com.songoda.skyblock.limit.LimitationInstanceHandler;
|
||||
import com.songoda.skyblock.listeners.*;
|
||||
import com.songoda.skyblock.listeners.Block;
|
||||
import com.songoda.skyblock.listeners.Bucket;
|
||||
import com.songoda.skyblock.listeners.Chat;
|
||||
import com.songoda.skyblock.listeners.Death;
|
||||
import com.songoda.skyblock.listeners.Entity;
|
||||
import com.songoda.skyblock.listeners.EpicSpawners;
|
||||
import com.songoda.skyblock.listeners.Food;
|
||||
import com.songoda.skyblock.listeners.Grow;
|
||||
import com.songoda.skyblock.listeners.Interact;
|
||||
import com.songoda.skyblock.listeners.Inventory;
|
||||
import com.songoda.skyblock.listeners.Item;
|
||||
import com.songoda.skyblock.listeners.Join;
|
||||
import com.songoda.skyblock.listeners.Move;
|
||||
import com.songoda.skyblock.listeners.Portal;
|
||||
import com.songoda.skyblock.listeners.Projectile;
|
||||
import com.songoda.skyblock.listeners.Quit;
|
||||
import com.songoda.skyblock.listeners.Respawn;
|
||||
import com.songoda.skyblock.listeners.Spawner;
|
||||
import com.songoda.skyblock.listeners.Teleport;
|
||||
import com.songoda.skyblock.listeners.UltimateStacker;
|
||||
import com.songoda.skyblock.listeners.WildStacker;
|
||||
import com.songoda.skyblock.localization.LocalizationManager;
|
||||
import com.songoda.skyblock.menus.Rollback;
|
||||
import com.songoda.skyblock.menus.admin.Creator;
|
||||
import com.songoda.skyblock.menus.admin.Generator;
|
||||
@ -38,17 +69,6 @@ import com.songoda.skyblock.world.WorldManager;
|
||||
import com.songoda.skyblock.world.generator.VoidGenerator;
|
||||
import com.songoda.update.Plugin;
|
||||
import com.songoda.update.SongodaUpdate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkyBlock extends JavaPlugin {
|
||||
|
||||
@ -78,6 +98,7 @@ public class SkyBlock extends JavaPlugin {
|
||||
private EconomyManager economyManager;
|
||||
private HologramManager hologramManager;
|
||||
private LimitationInstanceHandler limitationHandler;
|
||||
private LocalizationManager localizationManager;
|
||||
|
||||
public static SkyBlock getInstance() {
|
||||
return instance;
|
||||
@ -94,6 +115,7 @@ public class SkyBlock extends JavaPlugin {
|
||||
instance = this;
|
||||
|
||||
fileManager = new FileManager(this);
|
||||
localizationManager = new LocalizationManager();
|
||||
worldManager = new WorldManager(this);
|
||||
userCacheManager = new UserCacheManager(this);
|
||||
economyManager = new EconomyManager();
|
||||
@ -105,8 +127,7 @@ public class SkyBlock extends JavaPlugin {
|
||||
cooldownManager = new CooldownManager(this);
|
||||
limitationHandler = new LimitationInstanceHandler();
|
||||
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Scoreboard.Enable")) {
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Scoreboard.Enable")) {
|
||||
scoreboardManager = new ScoreboardManager(this);
|
||||
}
|
||||
|
||||
@ -117,13 +138,11 @@ public class SkyBlock extends JavaPlugin {
|
||||
structureManager = new StructureManager(this);
|
||||
soundManager = new SoundManager(this);
|
||||
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Generator.Enable")) {
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Generator.Enable")) {
|
||||
generatorManager = new GeneratorManager(this);
|
||||
}
|
||||
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Stackable.Enable")) {
|
||||
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.Enable")) {
|
||||
stackableManager = new StackableManager(this);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> stackableManager.loadSavedStackables(), 5L);
|
||||
}
|
||||
@ -160,12 +179,9 @@ public class SkyBlock extends JavaPlugin {
|
||||
pluginManager.registerEvents(new Food(this), this);
|
||||
pluginManager.registerEvents(new Grow(this), this);
|
||||
|
||||
if (pluginManager.isPluginEnabled("EpicSpawners"))
|
||||
pluginManager.registerEvents(new EpicSpawners(this), this);
|
||||
if (pluginManager.isPluginEnabled("WildStacker"))
|
||||
pluginManager.registerEvents(new WildStacker(this), this);
|
||||
if (pluginManager.isPluginEnabled("UltimateStacker"))
|
||||
pluginManager.registerEvents(new UltimateStacker(this), this);
|
||||
if (pluginManager.isPluginEnabled("EpicSpawners")) pluginManager.registerEvents(new EpicSpawners(this), this);
|
||||
if (pluginManager.isPluginEnabled("WildStacker")) pluginManager.registerEvents(new WildStacker(this), this);
|
||||
if (pluginManager.isPluginEnabled("UltimateStacker")) pluginManager.registerEvents(new UltimateStacker(this), this);
|
||||
|
||||
pluginManager.registerEvents(new Rollback(), this);
|
||||
pluginManager.registerEvents(new Levelling(), this);
|
||||
@ -335,4 +351,8 @@ public class SkyBlock extends JavaPlugin {
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
return new VoidGenerator();
|
||||
}
|
||||
|
||||
public LocalizationManager getLocalizationManager() {
|
||||
return localizationManager;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.skyblock.blockscanner;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
@ -12,6 +13,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@ -55,10 +58,14 @@ public final class BlockScanner extends BukkitRunnable {
|
||||
private final Queue<BlockInfo> blocks;
|
||||
private final ScannerTasks tasks;
|
||||
|
||||
private int scanY;
|
||||
|
||||
private BlockScanner(Map<World, List<ChunkSnapshot>> snapshots, ScannerTasks tasks) {
|
||||
this.blocks = new ConcurrentLinkedQueue<>();
|
||||
this.tasks = tasks;
|
||||
|
||||
FileConfiguration config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml")).getFileConfiguration();
|
||||
|
||||
int threadCount = 0;
|
||||
|
||||
for (Entry<World, List<ChunkSnapshot>> entry : snapshots.entrySet()) {
|
||||
@ -67,16 +74,37 @@ public final class BlockScanner extends BukkitRunnable {
|
||||
|
||||
threadCount += parts.size();
|
||||
|
||||
World world = entry.getKey();
|
||||
final String env;
|
||||
|
||||
switch (world.getEnvironment()) {
|
||||
case NETHER:
|
||||
env = "Nether";
|
||||
break;
|
||||
case THE_END:
|
||||
env = "End";
|
||||
break;
|
||||
default:
|
||||
env = "Normal";
|
||||
break;
|
||||
}
|
||||
|
||||
final ConfigurationSection liquidSection = config.getConfigurationSection("Island.World." + env + ".Liquid");
|
||||
|
||||
System.out.println("LiquidSection: " + liquidSection);
|
||||
|
||||
for (List<ChunkSnapshot> sub : parts) {
|
||||
queueWork(entry.getKey(), sub);
|
||||
queueWork(world, liquidSection.getBoolean("Enable") ? liquidSection.getInt("Height") + 1 : 0, sub);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.threadCount = threadCount;
|
||||
}
|
||||
|
||||
private void queueWork(World world, List<ChunkSnapshot> subList) {
|
||||
private void queueWork(World world, int scanY, List<ChunkSnapshot> subList) {
|
||||
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(SkyBlock.getInstance(), () -> {
|
||||
for (ChunkSnapshot shot : subList) {
|
||||
|
||||
@ -85,7 +113,7 @@ public final class BlockScanner extends BukkitRunnable {
|
||||
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int y = scanY; y < 256; y++) {
|
||||
|
||||
final Material type = VERSION > 12 ? shot.getBlockType(x, y, z) : MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z));
|
||||
|
||||
|
@ -42,10 +42,8 @@ public class ReloadCommand extends SubCommand {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
messageManager.sendMessage(sender,
|
||||
"&cPlease note that this command is not supported and may " + "cause issues that could put the plugin in an unstable state. "
|
||||
+ "If you encounter any issues please stop your server, edit the configuration files, "
|
||||
+ "and then start your server again. This command does NOT reload all the plugin files, only "
|
||||
+ "the config.yml, language.yml, generators.yml, levelling.yml, and limits.yml.");
|
||||
"&cPlease note that this command is not supported and may " + "cause issues that could put the plugin in an unstable state. " + "If you encounter any issues please stop your server, edit the configuration files, "
|
||||
+ "and then start your server again. This command does NOT reload all the plugin files, only " + "the config.yml, language.yml, generators.yml, levelling.yml, and limits.yml.");
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
@ -95,6 +93,7 @@ public class ReloadCommand extends SubCommand {
|
||||
});
|
||||
|
||||
limitHandler.reloadAll();
|
||||
skyblock.getLocalizationManager().reloadAll();
|
||||
MenuClickRegistry.getInstance().reloadAll();
|
||||
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message"));
|
||||
|
@ -9,7 +9,8 @@ import com.songoda.skyblock.hologram.HologramType;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@ -44,15 +45,15 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
HologramType hologramType = null;
|
||||
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "level":
|
||||
hologramType = HologramType.Level;
|
||||
break;
|
||||
case "bank":
|
||||
hologramType = HologramType.Bank;
|
||||
break;
|
||||
case "votes":
|
||||
hologramType = HologramType.Votes;
|
||||
break;
|
||||
case "level":
|
||||
hologramType = HologramType.Level;
|
||||
break;
|
||||
case "bank":
|
||||
hologramType = HologramType.Bank;
|
||||
break;
|
||||
case "votes":
|
||||
hologramType = HologramType.Votes;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hologramType != null) {
|
||||
@ -60,8 +61,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
FileConfiguration locationsConfigLoad = locationsConfig.getFileConfiguration();
|
||||
|
||||
if (locationsConfigLoad.getString("Location.Hologram.Leaderboard." + hologramType.name()) == null) {
|
||||
messageManager.sendMessage(sender,
|
||||
configLoad.getString("Command.Island.Admin.RemoveHologram.Set.Message"));
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Set.Message"));
|
||||
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
locationsConfigLoad.set("Location.Hologram.Leaderboard." + hologramType.name(), null);
|
||||
@ -73,8 +73,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
HologramType hologramType1 = HologramType
|
||||
.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
HologramType hologramType1 = HologramType.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
if (hologram != null) {
|
||||
@ -82,9 +81,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
}
|
||||
});
|
||||
|
||||
messageManager.sendMessage(sender,
|
||||
configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message")
|
||||
.replace("%type", hologramType.name()));
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message").replace("%type", hologramType.name()));
|
||||
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@ -113,6 +110,6 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public String[] getArguments() {
|
||||
return new String[]{"level", "bank", "votes"};
|
||||
return new String[] { "level", "bank", "votes" };
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ import com.songoda.skyblock.hologram.HologramType;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -14,9 +14,11 @@ import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.skyblock.utils.StringUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
|
||||
public class StackableCommand extends SubCommand {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
final MessageManager messageManager = skyblock.getMessageManager();
|
||||
@ -52,14 +54,15 @@ public class StackableCommand extends SubCommand {
|
||||
}
|
||||
|
||||
final StackableManager stackableManager = skyblock.getStackableManager();
|
||||
final Materials type = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
if (!stackableManager.isStackableMaterial(block.getType())) {
|
||||
if (!stackableManager.isStackableMaterial(type)) {
|
||||
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.Unstackable"));
|
||||
return;
|
||||
}
|
||||
|
||||
final Location loc = block.getLocation();
|
||||
Stackable stack = stackableManager.getStack(loc, block.getType());
|
||||
Stackable stack = stackableManager.getStack(loc, type);
|
||||
|
||||
if (amount <= 1) {
|
||||
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.Remove-Stack"));
|
||||
@ -70,7 +73,7 @@ public class StackableCommand extends SubCommand {
|
||||
final int oldSize;
|
||||
|
||||
if (stack == null) {
|
||||
stack = new Stackable(loc, block.getType());
|
||||
stack = new Stackable(loc, type);
|
||||
stackableManager.addStack(stack);
|
||||
oldSize = 0;
|
||||
} else {
|
||||
|
@ -159,15 +159,7 @@ public class AcceptCommand extends SubCommand {
|
||||
"Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
}
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner",
|
||||
configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", configLoad
|
||||
.getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member",
|
||||
configLoad.getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
|
||||
scoreboard.run();
|
||||
}
|
||||
}
|
||||
@ -189,15 +181,7 @@ public class AcceptCommand extends SubCommand {
|
||||
configLoad.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
}
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner",
|
||||
configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator",
|
||||
configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member",
|
||||
configLoad.getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
scoreboard.run();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public class UpgradeCommand extends SubCommand {
|
||||
if (!skyblock.getEconomyManager().isEconomy()) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@ import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,9 +1,5 @@
|
||||
package com.songoda.skyblock.config;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.EnumMap;
|
||||
@ -11,29 +7,29 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
|
||||
public class FileChecker {
|
||||
|
||||
private final FileManager fileManager;
|
||||
|
||||
private Map<File.Type, File> loadedFiles;
|
||||
|
||||
public FileChecker(SkyBlock skyblock, FileManager fileManager, String configurationFileName,
|
||||
boolean applyComments) {
|
||||
public FileChecker(SkyBlock skyblock, FileManager fileManager, String configurationFileName, boolean applyComments) {
|
||||
this.fileManager = fileManager;
|
||||
|
||||
loadedFiles = new EnumMap<>(File.Type.class);
|
||||
|
||||
java.io.File configFile = new java.io.File(skyblock.getDataFolder(), configurationFileName);
|
||||
loadedFiles.put(File.Type.CREATED,
|
||||
new File(fileManager, configFile, YamlConfiguration.loadConfiguration(configFile)));
|
||||
loadedFiles.put(File.Type.CREATED, new File(fileManager, configFile, YamlConfiguration.loadConfiguration(configFile)));
|
||||
|
||||
if (applyComments) {
|
||||
loadedFiles.put(File.Type.RESOURCE,
|
||||
new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager
|
||||
.getConfigContent(new InputStreamReader(skyblock.getResource(configurationFileName)))))));
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(new InputStreamReader(skyblock.getResource(configurationFileName)))))));
|
||||
} else {
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(skyblock.getResource(configurationFileName)))));
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(skyblock.getResource(configurationFileName)))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,8 +99,7 @@ public class FileChecker {
|
||||
configKeys = new HashMap<>();
|
||||
|
||||
if (configFile != null && configFile.getName().equals("config.yml")) {
|
||||
this.configLoad = YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(configFile)));
|
||||
this.configLoad = YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(configFile)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +120,8 @@ public class FileChecker {
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
CREATED, RESOURCE
|
||||
CREATED,
|
||||
RESOURCE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
package com.songoda.skyblock.config;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -17,6 +20,16 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
|
||||
public class FileManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
@ -32,13 +45,13 @@ public class FileManager {
|
||||
if (!skyblock.getDataFolder().exists()) {
|
||||
skyblock.getDataFolder().mkdir();
|
||||
}
|
||||
|
||||
|
||||
File structureDirectory = new File(skyblock.getDataFolder().toString() + "/structures");
|
||||
|
||||
if (!structureDirectory.exists()) {
|
||||
structureDirectory.mkdir();
|
||||
}
|
||||
|
||||
|
||||
// Will remain null unless WorldEdit is present.
|
||||
File schematicsDirectory = null;
|
||||
|
||||
@ -57,17 +70,16 @@ public class FileManager {
|
||||
configFiles.put("generators.yml", new File(skyblock.getDataFolder(), "generators.yml"));
|
||||
configFiles.put("stackables.yml", new File(skyblock.getDataFolder(), "stackables.yml"));
|
||||
configFiles.put("structures.yml", new File(skyblock.getDataFolder(), "structures.yml"));
|
||||
configFiles.put("structures/default.structure",
|
||||
new File(skyblock.getDataFolder().toString() + "/structures", "default.structure"));
|
||||
|
||||
configFiles.put("structures/default.structure", new File(skyblock.getDataFolder().toString() + "/structures", "default.structure"));
|
||||
|
||||
File oldStructureFile = new File(skyblock.getDataFolder().toString() + "/structures", "default.structure");
|
||||
oldStructureFile.delete();
|
||||
|
||||
for (Entry<String, File> configEntry : configFiles.entrySet()) {
|
||||
|
||||
|
||||
String fileName = configEntry.getKey();
|
||||
File configFile = configEntry.getValue();
|
||||
|
||||
|
||||
if (fileName.equals("structures/default.structure")) {
|
||||
configFile.delete();
|
||||
try {
|
||||
@ -75,8 +87,7 @@ public class FileManager {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try (InputStream is = skyblock.getResource(fileName);
|
||||
OutputStream os = new FileOutputStream(configFile)) {
|
||||
try (InputStream is = skyblock.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
ByteStreams.copy(is, os);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -85,8 +96,7 @@ public class FileManager {
|
||||
}
|
||||
|
||||
if (configFile.exists()) {
|
||||
if (fileName.equals("config.yml") || fileName.equals("language.yml")
|
||||
|| fileName.equals("settings.yml")) {
|
||||
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml")) {
|
||||
FileChecker fileChecker;
|
||||
|
||||
if (fileName.equals("config.yml")) {
|
||||
@ -102,8 +112,7 @@ public class FileManager {
|
||||
} else {
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
try (InputStream is = skyblock.getResource(fileName);
|
||||
OutputStream os = new FileOutputStream(configFile)) {
|
||||
try (InputStream is = skyblock.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
ByteStreams.copy(is, os);
|
||||
}
|
||||
|
||||
@ -119,12 +128,8 @@ public class FileManager {
|
||||
|
||||
for (IslandWorld worldList : IslandWorld.values()) {
|
||||
if (mainConfigLoad.getString("World." + worldList.name()) != null) {
|
||||
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.x",
|
||||
mainConfigLoad.getDouble(
|
||||
"World." + worldList.name() + ".nextAvailableLocation.x"));
|
||||
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.z",
|
||||
mainConfigLoad.getDouble(
|
||||
"World." + worldList.name() + ".nextAvailableLocation.z"));
|
||||
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.x", mainConfigLoad.getDouble("World." + worldList.name() + ".nextAvailableLocation.x"));
|
||||
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.z", mainConfigLoad.getDouble("World." + worldList.name() + ".nextAvailableLocation.z"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,8 +140,7 @@ public class FileManager {
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getServer().getLogger().log(Level.WARNING,
|
||||
"SkyBlock | Error: Unable to create configuration file.");
|
||||
Bukkit.getServer().getLogger().log(Level.WARNING, "SkyBlock | Error: Unable to create configuration file.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -229,8 +233,7 @@ public class FileManager {
|
||||
|
||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||
if (currentLine.contains("#")) {
|
||||
addLine = currentLine.replace("[!]", "IMPORTANT").replace(":", "-").replaceFirst("#",
|
||||
pluginName + "_COMMENT_" + commentNum + ":");
|
||||
addLine = currentLine.replace("[!]", "IMPORTANT").replace(":", "-").replaceFirst("#", pluginName + "_COMMENT_" + commentNum + ":");
|
||||
whole.append(addLine + "\n");
|
||||
commentNum++;
|
||||
} else {
|
||||
@ -270,9 +273,7 @@ public class FileManager {
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.contains(skyblock.getDescription().getName() + "_COMMENT")) {
|
||||
config.append(line.replace("IMPORTANT", "[!]").replace("\n", "")
|
||||
.replace(skyblock.getDescription().getName() + "_COMMENT_", "#").replaceAll("[0-9]+:", "")
|
||||
+ "\n");
|
||||
config.append(line.replace("IMPORTANT", "[!]").replace("\n", "").replace(skyblock.getDescription().getName() + "_COMMENT_", "#").replaceAll("[0-9]+:", "") + "\n");
|
||||
} else if (line.contains(":")) {
|
||||
config.append(line + "\n");
|
||||
}
|
||||
@ -301,8 +302,7 @@ public class FileManager {
|
||||
configFile = configPath;
|
||||
|
||||
if (configPath.getName().equals("config.yml")) {
|
||||
configLoad = YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(configFile)));
|
||||
configLoad = YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(configFile)));
|
||||
} else {
|
||||
configLoad = YamlConfiguration.loadConfiguration(configPath);
|
||||
}
|
||||
|
@ -1,16 +1,18 @@
|
||||
package com.songoda.skyblock.economy;
|
||||
|
||||
import com.songoda.skyblock.api.event.player.PlayerWithdrawMoneyEvent;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.tnemc.core.Reserve;
|
||||
import net.tnemc.core.economy.EconomyAPI;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.songoda.skyblock.api.event.player.PlayerWithdrawMoneyEvent;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.tnemc.core.Reserve;
|
||||
import net.tnemc.core.economy.EconomyAPI;
|
||||
|
||||
public class EconomyManager {
|
||||
|
||||
@ -20,7 +22,7 @@ public class EconomyManager {
|
||||
|
||||
// Reserve
|
||||
private EconomyAPI reserveEconomy = null;
|
||||
// private PermissionsAPI reservePermission = null;
|
||||
// private PermissionsAPI reservePermission = null;
|
||||
|
||||
public EconomyManager() {
|
||||
setup();
|
||||
@ -30,27 +32,22 @@ public class EconomyManager {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
RegisteredServiceProvider<Economy> economyRsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
|
||||
if (economyRsp != null)
|
||||
this.vaultEconomy = economyRsp.getProvider();
|
||||
if (economyRsp != null) this.vaultEconomy = economyRsp.getProvider();
|
||||
|
||||
RegisteredServiceProvider<Permission> permissionRsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (permissionRsp != null)
|
||||
this.vaultPermission = permissionRsp.getProvider();
|
||||
if (permissionRsp != null) this.vaultPermission = permissionRsp.getProvider();
|
||||
} else if (Bukkit.getServer().getPluginManager().getPlugin("Reserve") != null) {
|
||||
if (Reserve.instance().economyProvided())
|
||||
this.reserveEconomy = Reserve.instance().economy();
|
||||
if (Reserve.instance().economyProvided()) this.reserveEconomy = Reserve.instance().economy();
|
||||
|
||||
// if (Reserve.instance().permissionsProvided())
|
||||
// this.reservePermission = Reserve.instance().permissions();
|
||||
// if (Reserve.instance().permissionsProvided())
|
||||
// this.reservePermission = Reserve.instance().permissions();
|
||||
}
|
||||
}
|
||||
|
||||
public double getBalance(Player player) {
|
||||
if (this.vaultEconomy != null)
|
||||
return this.vaultEconomy.getBalance(player);
|
||||
if (this.vaultEconomy != null) return this.vaultEconomy.getBalance(player);
|
||||
|
||||
if (this.reserveEconomy != null)
|
||||
return this.reserveEconomy.getHoldings(player.getUniqueId()).doubleValue();
|
||||
if (this.reserveEconomy != null) return this.reserveEconomy.getHoldings(player.getUniqueId()).doubleValue();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -60,30 +57,25 @@ public class EconomyManager {
|
||||
}
|
||||
|
||||
public void withdraw(Player player, double money) {
|
||||
if (this.vaultEconomy != null)
|
||||
this.vaultEconomy.withdrawPlayer(player, money);
|
||||
else if (this.reserveEconomy != null)
|
||||
this.reserveEconomy.removeHoldings(player.getUniqueId(), new BigDecimal(money));
|
||||
if (this.vaultEconomy != null) this.vaultEconomy.withdrawPlayer(player, money);
|
||||
else if (this.reserveEconomy != null) this.reserveEconomy.removeHoldings(player.getUniqueId(), new BigDecimal(money));
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerWithdrawMoneyEvent(player, money));
|
||||
}
|
||||
|
||||
public void deposit(Player player, double money) {
|
||||
if (this.vaultEconomy != null)
|
||||
this.vaultEconomy.depositPlayer(player, money);
|
||||
else if (this.reserveEconomy != null)
|
||||
this.reserveEconomy.addHoldings(player.getUniqueId(), new BigDecimal(money));
|
||||
if (this.vaultEconomy != null) this.vaultEconomy.depositPlayer(player, money);
|
||||
else if (this.reserveEconomy != null) this.reserveEconomy.addHoldings(player.getUniqueId(), new BigDecimal(money));
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerWithdrawMoneyEvent(player, money));
|
||||
}
|
||||
|
||||
public boolean hasPermission(String world, OfflinePlayer offlinePlayer, String perm) {
|
||||
if (this.vaultPermission != null)
|
||||
return this.vaultPermission.playerHas(world, offlinePlayer, perm);
|
||||
if (this.vaultPermission != null) return this.vaultPermission.playerHas(world, offlinePlayer, perm);
|
||||
|
||||
// if (this.reservePermission != null) {
|
||||
// // TODO
|
||||
// }
|
||||
// if (this.reservePermission != null) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -93,6 +85,6 @@ public class EconomyManager {
|
||||
}
|
||||
|
||||
public boolean isPermission() {
|
||||
return this.vaultPermission != null/* || this.reservePermission != null*/;
|
||||
return this.vaultPermission != null/* || this.reservePermission != null */;
|
||||
}
|
||||
}
|
||||
|
@ -755,13 +755,13 @@ public class Island {
|
||||
|
||||
Config config = fileManager
|
||||
.getConfig(new File(skyblock.getDataFolder().toString() + "/island-data", ownerUUID.toString() + ".yml"));
|
||||
|
||||
|
||||
try {
|
||||
config.getFileConfiguration().save(config.getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
config = fileManager
|
||||
.getConfig(new File(skyblock.getDataFolder().toString() + "/setting-data", ownerUUID.toString() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
@ -25,7 +25,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
@ -236,7 +235,8 @@ public class IslandManager {
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(new IslandCreateEvent(island.getAPIWrapper(), player)));
|
||||
|
||||
skyblock.getPlayerDataManager().getPlayerData(player).setIsland(player.getUniqueId());
|
||||
data.setIsland(player.getUniqueId());
|
||||
data.setOwner(player.getUniqueId());
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
Config languageConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
@ -639,12 +639,6 @@ public class IslandManager {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Scoreboard.Island.Team.Displayname")));
|
||||
scoreboard.setDisplayList(configLoad.getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
||||
|
||||
HashMap<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner", configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member", configLoad.getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
scoreboard.run();
|
||||
}
|
||||
} catch (IllegalPluginAccessException e) {
|
||||
@ -888,12 +882,7 @@ public class IslandManager {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Scoreboard.Island.Team.Displayname")));
|
||||
scoreboard.setDisplayList(configLoad.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
|
||||
HashMap<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner", configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member", configLoad.getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
}
|
||||
|
||||
scoreboard.run();
|
||||
|
@ -3,14 +3,18 @@ package com.songoda.skyblock.levelling.rework;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -33,6 +37,20 @@ import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
|
||||
public final class IslandLevelManager {
|
||||
|
||||
private static final Set<Materials> CHECKED_DOUBLE_TYPES;
|
||||
|
||||
static {
|
||||
CHECKED_DOUBLE_TYPES = EnumSet.noneOf(Materials.class);
|
||||
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.SUNFLOWER);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.LILAC);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.LEGACY_DOUBLE_PLANT);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.LARGE_FERN);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.ROSE_BUSH);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.PEONY);
|
||||
CHECKED_DOUBLE_TYPES.add(Materials.TALL_GRASS);
|
||||
}
|
||||
|
||||
private final static int VERSION = NMSUtil.getVersionNumber();
|
||||
private Map<Island, IslandScan> inScan;
|
||||
private Map<Materials, Long> worth;
|
||||
@ -46,6 +64,16 @@ public final class IslandLevelManager {
|
||||
reloadWorth();
|
||||
}
|
||||
|
||||
public static boolean isDoubleCheckedBlock(Block block) {
|
||||
return CHECKED_DOUBLE_TYPES.contains(parseType(block));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Materials parseType(Block block) {
|
||||
final Material blockType = block.getType();
|
||||
return VERSION > 12 ? Materials.fromString(blockType.name()) : Materials.requestMaterials(blockType.name(), block.getData());
|
||||
}
|
||||
|
||||
public void startScan(Player attemptScanner, Island island) {
|
||||
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
@ -103,7 +131,7 @@ public final class IslandLevelManager {
|
||||
|
||||
final Materials material = Materials.fromString(key);
|
||||
|
||||
if (material.isAvailable() || material.getPostItem() == null) continue;
|
||||
if (material == null || !material.isAvailable()) continue;
|
||||
|
||||
worth.put(material, current.getLong("Points"));
|
||||
}
|
||||
@ -151,23 +179,42 @@ public final class IslandLevelManager {
|
||||
|
||||
private static final AmountMaterialPair EMPTY = new AmountMaterialPair(null, 0);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public AmountMaterialPair getAmountAndType(BlockInfo info) {
|
||||
AmountMaterialPair getAmountAndType(IslandScan scan, BlockInfo info) {
|
||||
|
||||
final Block block = info.getWorld().getBlockAt(info.getX(), info.getY(), info.getZ());
|
||||
final Material blockType = block.getType();
|
||||
Block block = info.getWorld().getBlockAt(info.getX(), info.getY(), info.getZ());
|
||||
Material blockType = block.getType();
|
||||
|
||||
if (blockType == Material.AIR) return EMPTY;
|
||||
|
||||
Materials finalType = VERSION > 12 ? Materials.fromString(blockType.name()) : Materials.requestMaterials(blockType.name(), block.getData());
|
||||
Materials finalType = parseType(block);
|
||||
|
||||
if (finalType == null) return EMPTY;
|
||||
if (finalType == Materials.SPAWNER) finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
|
||||
|
||||
final Location blockLocation = block.getLocation();
|
||||
|
||||
if (scan.getDoubleBlocks().contains(blockLocation)) return EMPTY;
|
||||
|
||||
if (CHECKED_DOUBLE_TYPES.contains(finalType)) {
|
||||
|
||||
final Block belowBlock = block.getRelative(BlockFace.DOWN);
|
||||
final Materials belowType = parseType(belowBlock);
|
||||
|
||||
if (CHECKED_DOUBLE_TYPES.contains(belowType)) {
|
||||
block = belowBlock;
|
||||
blockType = belowType.parseMaterial();
|
||||
scan.getDoubleBlocks().add(belowBlock.getLocation());
|
||||
} else {
|
||||
scan.getDoubleBlocks().add(block.getRelative(BlockFace.UP).getLocation());
|
||||
}
|
||||
|
||||
} else if (finalType == Materials.SPAWNER) {
|
||||
finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
|
||||
}
|
||||
|
||||
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType);
|
||||
final StackableManager stackableManager = SkyBlock.getInstance().getStackableManager();
|
||||
|
||||
final long stackSize = stackableManager == null ? 0 : stackableManager.getStackSizeOf(block.getLocation(), blockType);
|
||||
final long stackSize = stackableManager == null ? 0 : stackableManager.getStackSizeOf(blockLocation, finalType);
|
||||
|
||||
if (calculators == null) {
|
||||
|
||||
|
@ -4,15 +4,18 @@ import java.io.File;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.EnumMap;
|
||||
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.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -36,6 +39,7 @@ public final class IslandScan extends BukkitRunnable {
|
||||
|
||||
private static final NumberFormat FORMATTER = NumberFormat.getInstance();;
|
||||
|
||||
private final Set<Location> doubleBlocks;
|
||||
private final Island island;
|
||||
private final Map<Materials, BlockAmount> amounts;
|
||||
private final Configuration config;
|
||||
@ -51,14 +55,14 @@ public final class IslandScan extends BukkitRunnable {
|
||||
this.amounts = new EnumMap<>(Materials.class);
|
||||
this.config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
this.runEveryX = config.getInt("Command.Island.Level.Scanning.Progress.Display-Every-X-Scan");
|
||||
this.doubleBlocks = new HashSet<>();
|
||||
}
|
||||
|
||||
public IslandScan start() {
|
||||
final SkyBlock skyblock = SkyBlock.getInstance();
|
||||
|
||||
final FileConfiguration config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration();
|
||||
final FileConfiguration islandData = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), this.island.getOwnerUUID().toString() + ".yml")).getFileConfiguration();
|
||||
final FileConfiguration islandData = skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), this.island.getOwnerUUID().toString() + ".yml")).getFileConfiguration();
|
||||
|
||||
final boolean hasNether = config.getBoolean("Island.World.Nether.Enable") && islandData.getBoolean("Unlocked.Nether", false);
|
||||
final boolean hasEnd = config.getBoolean("Island.World.End.Enable") && islandData.getBoolean("Unlocked.End", false);
|
||||
@ -109,7 +113,7 @@ public final class IslandScan extends BukkitRunnable {
|
||||
|
||||
if (scanned == 8500) break;
|
||||
|
||||
final AmountMaterialPair pair = SkyBlock.getInstance().getLevellingManager().getAmountAndType(info);
|
||||
final AmountMaterialPair pair = SkyBlock.getInstance().getLevellingManager().getAmountAndType(this, info);
|
||||
|
||||
if (pair.getType() != null) {
|
||||
|
||||
@ -164,4 +168,8 @@ public final class IslandScan extends BukkitRunnable {
|
||||
snapshots.put(skyblock.getWorldManager().getWorld(world), ChunkUtil.getChunksToScan(island, world).stream().map(org.bukkit.Chunk::getChunkSnapshot).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public Set<Location> getDoubleBlocks() {
|
||||
return doubleBlocks;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -85,22 +85,27 @@ public class Block implements Listener {
|
||||
|
||||
if (!islandManager.hasPermission(player, blockLocation, "Destroy")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), block.getType());
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.getMaterials(block.getType(), block.getData()));
|
||||
if (stackable != null) {
|
||||
Material material = block.getType();
|
||||
byte data = block.getData();
|
||||
|
||||
int droppedAmount = 0;
|
||||
if (event.getPlayer().isSneaking()) {
|
||||
droppedAmount = stackable.getSize();
|
||||
block.getWorld().dropItemNaturally(blockLocation.clone().add(0.5, 0.5, 0.5), new ItemStack(material, droppedAmount, block.getData()));
|
||||
Location dropLoc = blockLocation.clone().add(0.5, 0.5, 0.5);
|
||||
int count = stackable.getSize();
|
||||
droppedAmount = count;
|
||||
while (count > 64) {
|
||||
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, 64, data));
|
||||
count -= 64;
|
||||
}
|
||||
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, count, block.getData()));
|
||||
block.setType(Material.AIR);
|
||||
stackable.setSize(0);
|
||||
} else {
|
||||
@ -146,14 +151,23 @@ public class Block implements Listener {
|
||||
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())) {
|
||||
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.isCancelled() || !configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||
|
||||
if (IslandLevelManager.isDoubleCheckedBlock(block)) {
|
||||
|
||||
final org.bukkit.block.Block belowBlock = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (IslandLevelManager.isDoubleCheckedBlock(belowBlock)) {
|
||||
block = belowBlock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final Materials materials;
|
||||
|
||||
if (block.getType() == Materials.SPAWNER.parseMaterial()) {
|
||||
@ -189,7 +203,7 @@ public class Block implements Listener {
|
||||
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||
|
||||
Location blockLoc = block.getLocation();
|
||||
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(blockLoc);
|
||||
|
||||
if (island == null) {
|
||||
@ -198,24 +212,23 @@ public class Block implements Listener {
|
||||
}
|
||||
|
||||
if (levellingManager.isScanning(island)) {
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!islandManager.hasPermission(player, blockLoc, "Place")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||
|
||||
|
||||
if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) {
|
||||
if (!islandManager.isLocationAtIsland(island, blockLoc, world)) {
|
||||
event.setCancelled(true);
|
||||
@ -238,8 +251,7 @@ public class Block implements Listener {
|
||||
}
|
||||
|
||||
if (isObstructing) {
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
@ -254,9 +266,8 @@ public class Block implements Listener {
|
||||
if (limits.isBlockLimitExceeded(player, block, limit)) {
|
||||
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
@ -338,8 +349,8 @@ public class Block implements Listener {
|
||||
// Filter valid players on the island
|
||||
Set<Player> possiblePlayers = new HashSet<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
boolean isMember = island.hasRole(IslandRole.Owner, p.getUniqueId()) || island.hasRole(IslandRole.Member, p.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Coop, p.getUniqueId()) || island.hasRole(IslandRole.Operator, p.getUniqueId());
|
||||
boolean isMember = island.hasRole(IslandRole.Owner, p.getUniqueId()) || island.hasRole(IslandRole.Member, p.getUniqueId()) || island.hasRole(IslandRole.Coop, p.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Operator, p.getUniqueId());
|
||||
if (isMember && islandManager.isLocationAtIsland(island, p.getLocation(), world)) {
|
||||
possiblePlayers.add(p);
|
||||
}
|
||||
@ -387,8 +398,7 @@ public class Block implements Listener {
|
||||
|
||||
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
|
||||
for (org.bukkit.block.Block block : event.getBlocks()) {
|
||||
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world)
|
||||
|| !islandManager.isLocationAtIsland(island, block.getRelative(event.getDirection()).getLocation(), world)) {
|
||||
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world) || !islandManager.isLocationAtIsland(island, block.getRelative(event.getDirection()).getLocation(), world)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -513,8 +523,7 @@ public class Block implements Listener {
|
||||
|
||||
// Check ice/snow forming
|
||||
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
|
||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.IceAndSnow"))
|
||||
event.setCancelled(true);
|
||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.IceAndSnow")) event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -550,8 +559,8 @@ public class Block implements Listener {
|
||||
// Filter valid players on the island.
|
||||
Set<Player> possiblePlayers = new HashSet<>();
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) || island.hasRole(IslandRole.Member, player.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Coop, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId());
|
||||
boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) || island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Coop, player.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Operator, player.getUniqueId());
|
||||
if (isMember && islandManager.isLocationAtIsland(island, player.getLocation(), world)) {
|
||||
possiblePlayers.add(player);
|
||||
}
|
||||
|
@ -1,26 +1,8 @@
|
||||
package com.songoda.skyblock.listeners;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
|
||||
import com.songoda.skyblock.limit.impl.BlockLimitation;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.item.InventoryUtil;
|
||||
import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -46,7 +28,25 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
|
||||
import com.songoda.skyblock.limit.impl.BlockLimitation;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.item.InventoryUtil;
|
||||
import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
|
||||
public class Interact implements Listener {
|
||||
|
||||
@ -83,8 +83,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "DragonEggUse")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -93,8 +92,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Beacon")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -103,8 +101,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -113,8 +110,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Place") || !islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -127,16 +123,25 @@ public class Interact implements Listener {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, "Projectile")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (stackableManager != null && stackableManager.isStackableMaterial(event.getMaterial()) && event.getClickedBlock().getType() == event.getMaterial() && !player.isSneaking()
|
||||
&& islandManager.hasPermission(player, block.getLocation(), "Place")
|
||||
|
||||
final Materials blockType = Materials.getMaterials(event.getClickedBlock().getType(), event.getClickedBlock().getData());
|
||||
final Materials heldType;
|
||||
final ItemStack item = event.getItem();
|
||||
|
||||
if (item != null && item.getType() != Material.AIR) {
|
||||
heldType = Materials.getMaterials(event.getItem().getType(), (byte) event.getItem().getDurability());
|
||||
} else {
|
||||
heldType = Materials.AIR;
|
||||
}
|
||||
|
||||
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType == heldType && !player.isSneaking() && islandManager.hasPermission(player, block.getLocation(), "Place")
|
||||
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission")
|
||||
|| player.hasPermission("fabledskyblock.stackable"))) {
|
||||
if (NMSUtil.getVersionNumber() > 8) {
|
||||
@ -144,8 +149,8 @@ public class Interact implements Listener {
|
||||
}
|
||||
|
||||
if (levellingManager.isScanning(island)) {
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -157,9 +162,8 @@ public class Interact implements Listener {
|
||||
if (limits.isBlockLimitExceeded(player, block, limit)) {
|
||||
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
@ -167,11 +171,11 @@ public class Interact implements Listener {
|
||||
}
|
||||
|
||||
Location location = event.getClickedBlock().getLocation();
|
||||
Stackable stackable = stackableManager.getStack(location, event.getMaterial());
|
||||
Stackable stackable = stackableManager.getStack(location, blockType);
|
||||
int itemAmount = event.getItem().getAmount();
|
||||
|
||||
if (stackable == null) {
|
||||
stackableManager.addStack(stackable = new Stackable(location, event.getMaterial()));
|
||||
stackableManager.addStack(stackable = new Stackable(location, blockType));
|
||||
stackable.setSize(itemAmount + 1);
|
||||
} else {
|
||||
stackable.setSize(stackable.getSize() + itemAmount);
|
||||
@ -182,7 +186,7 @@ public class Interact implements Listener {
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
|
||||
if (!configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||
|
||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||
@ -218,8 +222,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -228,26 +231,21 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Anvil")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (block.getType() == Materials.LEGACY_BED_BLOCK.parseMaterial() || block.getType() == Materials.WHITE_BED.parseMaterial()
|
||||
|| block.getType() == Materials.ORANGE_BED.parseMaterial() || block.getType() == Materials.MAGENTA_BED.parseMaterial()
|
||||
|| block.getType() == Materials.LIGHT_BLUE_BED.parseMaterial() || block.getType() == Materials.YELLOW_BED.parseMaterial()
|
||||
} else if (block.getType() == Materials.LEGACY_BED_BLOCK.parseMaterial() || block.getType() == Materials.WHITE_BED.parseMaterial() || block.getType() == Materials.ORANGE_BED.parseMaterial()
|
||||
|| block.getType() == Materials.MAGENTA_BED.parseMaterial() || block.getType() == Materials.LIGHT_BLUE_BED.parseMaterial() || block.getType() == Materials.YELLOW_BED.parseMaterial()
|
||||
|| block.getType() == Materials.LIME_BED.parseMaterial() || block.getType() == Materials.PINK_BED.parseMaterial() || block.getType() == Materials.GRAY_BED.parseMaterial()
|
||||
|| block.getType() == Materials.LIGHT_GRAY_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial()
|
||||
|| block.getType() == Materials.CYAN_BED.parseMaterial() || block.getType() == Materials.PURPLE_BED.parseMaterial()
|
||||
|| block.getType() == Materials.BLUE_BED.parseMaterial() || block.getType() == Materials.BROWN_BED.parseMaterial()
|
||||
|| block.getType() == Materials.GREEN_BED.parseMaterial() || block.getType() == Materials.RED_BED.parseMaterial()
|
||||
|| block.getType() == Materials.BLACK_BED.parseMaterial()) {
|
||||
|| block.getType() == Materials.LIGHT_GRAY_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial()
|
||||
|| block.getType() == Materials.PURPLE_BED.parseMaterial() || block.getType() == Materials.BLUE_BED.parseMaterial() || block.getType() == Materials.BROWN_BED.parseMaterial()
|
||||
|| block.getType() == Materials.GREEN_BED.parseMaterial() || block.getType() == Materials.RED_BED.parseMaterial() || block.getType() == Materials.BLACK_BED.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Bed")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -257,50 +255,43 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Brewing")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST
|
||||
|| (NMSUtil.getVersionNumber() > 9 && (block.getType() == Materials.SHULKER_BOX.parseMaterial() || block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BROWN_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GRAY_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.GREEN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIGHT_BLUE_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.LIGHT_GRAY_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIME_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.MAGENTA_SHULKER_BOX.parseMaterial() || block.getType() == Materials.ORANGE_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.PINK_SHULKER_BOX.parseMaterial() || block.getType() == Materials.PURPLE_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.RED_SHULKER_BOX.parseMaterial() || block.getType() == Materials.WHITE_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.YELLOW_SHULKER_BOX.parseMaterial()))) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
|
||||
event.setCancelled(true);
|
||||
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || (NMSUtil.getVersionNumber() > 9 && (block.getType() == Materials.SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BROWN_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GRAY_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GREEN_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.LIGHT_BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIGHT_GRAY_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIME_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.MAGENTA_SHULKER_BOX.parseMaterial() || block.getType() == Materials.ORANGE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.PINK_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.PURPLE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.RED_SHULKER_BOX.parseMaterial() || block.getType() == Materials.WHITE_SHULKER_BOX.parseMaterial()
|
||||
|| block.getType() == Materials.YELLOW_SHULKER_BOX.parseMaterial()))) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
}
|
||||
} else
|
||||
if (block.getType() == Materials.CRAFTING_TABLE.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Workbench")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (block.getType() == Material.BIRCH_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR
|
||||
|| block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.SPRUCE_DOOR || block.getType() == Materials.LEGACY_WOODEN_DOOR.parseMaterial()
|
||||
|| block.getType() == Materials.OAK_DOOR.parseMaterial()) {
|
||||
} else if (block.getType() == Material.BIRCH_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR || block.getType() == Material.JUNGLE_DOOR
|
||||
|| block.getType() == Material.SPRUCE_DOOR || block.getType() == Materials.LEGACY_WOODEN_DOOR.parseMaterial() || block.getType() == Materials.OAK_DOOR.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Door")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -310,8 +301,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Enchant")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -320,21 +310,19 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Furnace")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (block.getType() == Material.STONE_BUTTON || block.getType() == Materials.OAK_BUTTON.parseMaterial()
|
||||
|| block.getType() == Materials.SPRUCE_BUTTON.parseMaterial() || block.getType() == Materials.BIRCH_BUTTON.parseMaterial()
|
||||
|| block.getType() == Materials.JUNGLE_BUTTON.parseMaterial() || block.getType() == Materials.ACACIA_BUTTON.parseMaterial()
|
||||
} else if (block.getType() == Material.STONE_BUTTON || block.getType() == Materials.OAK_BUTTON.parseMaterial() || block.getType() == Materials.SPRUCE_BUTTON.parseMaterial()
|
||||
|| block.getType() == Materials.BIRCH_BUTTON.parseMaterial() || block.getType() == Materials.JUNGLE_BUTTON.parseMaterial() || block.getType() == Materials.ACACIA_BUTTON.parseMaterial()
|
||||
|| block.getType() == Materials.DARK_OAK_BUTTON.parseMaterial() || block.getType() == Materials.LEVER.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "LeverButton")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -344,37 +332,35 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Jukebox")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (block.getType() == Materials.OAK_TRAPDOOR.parseMaterial() || block.getType() == Materials.SPRUCE_TRAPDOOR.parseMaterial()
|
||||
|| block.getType() == Materials.BIRCH_TRAPDOOR.parseMaterial() || block.getType() == Materials.JUNGLE_TRAPDOOR.parseMaterial()
|
||||
|| block.getType() == Materials.ACACIA_TRAPDOOR.parseMaterial() || block.getType() == Materials.DARK_OAK_TRAPDOOR.parseMaterial()
|
||||
} else if (block.getType() == Materials.OAK_TRAPDOOR.parseMaterial() || block.getType() == Materials.SPRUCE_TRAPDOOR.parseMaterial() || block.getType() == Materials.BIRCH_TRAPDOOR.parseMaterial()
|
||||
|| block.getType() == Materials.JUNGLE_TRAPDOOR.parseMaterial() || block.getType() == Materials.ACACIA_TRAPDOOR.parseMaterial() || block.getType() == Materials.DARK_OAK_TRAPDOOR.parseMaterial()
|
||||
|| block.getType() == Material.NOTE_BLOCK || block.getType() == Material.HOPPER || block.getType() == Materials.COMPARATOR.parseMaterial()
|
||||
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_OFF.parseMaterial()
|
||||
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_ON.parseMaterial() || block.getType() == Materials.REPEATER.parseMaterial()
|
||||
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_OFF.parseMaterial() || block.getType() == Materials.LEGACY_DIODE_BLOCK_ON.parseMaterial()) {
|
||||
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_OFF.parseMaterial() || block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_ON.parseMaterial()
|
||||
|| block.getType() == Materials.REPEATER.parseMaterial() || block.getType() == Materials.LEGACY_DIODE_BLOCK_OFF.parseMaterial()
|
||||
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_ON.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else
|
||||
if (block.getType() == Materials.OAK_FENCE_GATE.parseMaterial() || block.getType() == Material.ACACIA_FENCE_GATE
|
||||
|| block.getType() == Material.BIRCH_FENCE_GATE || block.getType() == Material.DARK_OAK_FENCE_GATE || block.getType() == Material.JUNGLE_FENCE_GATE
|
||||
|| block.getType() == Material.SPRUCE_FENCE_GATE) {
|
||||
if (block.getType() == Materials.OAK_FENCE_GATE.parseMaterial() || block.getType() == Material.ACACIA_FENCE_GATE || block.getType() == Material.BIRCH_FENCE_GATE
|
||||
|| block.getType() == Material.DARK_OAK_FENCE_GATE || block.getType() == Material.JUNGLE_FENCE_GATE || block.getType() == Material.SPRUCE_FENCE_GATE) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Gate")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -384,8 +370,8 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "DropperDispenser")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -394,8 +380,8 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -404,8 +390,8 @@ public class Interact implements Listener {
|
||||
if (player.getFoodLevel() < 20 && !islandManager.hasPermission(player, block.getLocation(), "Cake")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -414,16 +400,16 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Hopper")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if ((player.getGameMode() == GameMode.SURVIVAL) && (block.getType() == Material.OBSIDIAN) && (event.getItem() != null)
|
||||
&& (event.getItem().getType() != Material.AIR) && (event.getItem().getType() == Material.BUCKET)) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Block.Obsidian.Enable") && islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||
} else if ((player.getGameMode() == GameMode.SURVIVAL) && (block.getType() == Material.OBSIDIAN) && (event.getItem() != null) && (event.getItem().getType() != Material.AIR)
|
||||
&& (event.getItem().getType() == Material.BUCKET)) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.Obsidian.Enable")
|
||||
&& islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||
int NMSVersion = NMSUtil.getVersionNumber();
|
||||
boolean isInventoryFull = false;
|
||||
|
||||
@ -460,8 +446,8 @@ public class Interact implements Listener {
|
||||
}
|
||||
} else
|
||||
if (block.getType() == Materials.END_PORTAL_FRAME.parseMaterial()) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Block.EndFrame.Enable") && islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")
|
||||
&& islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 8 && event.getHand() == EquipmentSlot.OFF_HAND) return;
|
||||
|
||||
@ -476,19 +462,24 @@ public class Interact implements Listener {
|
||||
boolean hasEye = ((block.getData() >> 2) & 1) == 1;
|
||||
|
||||
if (is == null || is.getType() == Material.AIR) {
|
||||
|
||||
int size = 1;
|
||||
|
||||
if (stackableManager != null && stackableManager.isStacked(block.getLocation())) {
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.END_PORTAL_FRAME.parseMaterial());
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.END_PORTAL_FRAME);
|
||||
stackable.takeOne();
|
||||
|
||||
if (stackable.getSize() <= 1) {
|
||||
stackableManager.removeStack(stackable);
|
||||
}
|
||||
|
||||
size = stackable.getSize();
|
||||
} else {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
player.getInventory().addItem(new ItemStack(Materials.END_PORTAL_FRAME.parseMaterial(), 1));
|
||||
if (hasEye) player.getInventory().addItem(new ItemStack(Materials.ENDER_EYE.parseMaterial(), 1));
|
||||
if (hasEye && size == 1) player.getInventory().addItem(new ItemStack(Materials.ENDER_EYE.parseMaterial(), 1));
|
||||
player.updateInventory();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
@ -522,8 +513,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.updateInventory();
|
||||
@ -533,8 +523,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "WaterCollection")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.updateInventory();
|
||||
@ -544,8 +533,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "SpawnEgg")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.updateInventory();
|
||||
@ -554,8 +542,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "EntityPlacement")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.updateInventory();
|
||||
@ -568,8 +555,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Fire")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -580,13 +566,11 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Crop")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
} else if (block.getType() == Materials.STONE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.OAK_PRESSURE_PLATE.parseMaterial()
|
||||
|| block.getType() == Materials.SPRUCE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.BIRCH_PRESSURE_PLATE.parseMaterial()
|
||||
|| block.getType() == Materials.JUNGLE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.ACACIA_PRESSURE_PLATE.parseMaterial()
|
||||
} else if (block.getType() == Materials.STONE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.OAK_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.SPRUCE_PRESSURE_PLATE.parseMaterial()
|
||||
|| block.getType() == Materials.BIRCH_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.JUNGLE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.ACACIA_PRESSURE_PLATE.parseMaterial()
|
||||
|| block.getType() == Materials.DARK_OAK_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.LIGHT_WEIGHTED_PRESSURE_PLATE.parseMaterial()
|
||||
|| block.getType() == Materials.HEAVY_WEIGHTED_PRESSURE_PLATE.parseMaterial()) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "PressurePlate")) {
|
||||
@ -597,8 +581,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -617,32 +600,30 @@ public class Interact implements Listener {
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
ItemStack structureTool = StructureUtil.getTool();
|
||||
|
||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
||||
&& (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*")
|
||||
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta()) && (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*") || player.hasPermission("fabledskyblock.admin.*")
|
||||
|| player.hasPermission("fabledskyblock.*")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(1, event.getClickedBlock().getLocation());
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Structure.Tool.Position.Message").replace("%position", "1"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Structure.Tool.Position.Message").replace("%position", "1"));
|
||||
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
ItemStack structureTool = StructureUtil.getTool();
|
||||
|
||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
||||
&& (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*")
|
||||
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta()) && (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*") || player.hasPermission("fabledskyblock.admin.*")
|
||||
|| player.hasPermission("fabledskyblock.*")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(2, event.getClickedBlock().getLocation());
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Structure.Tool.Position.Message").replace("%position", "2"));
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Structure.Tool.Position.Message").replace("%position", "2"));
|
||||
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -670,8 +651,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Leash")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -687,8 +667,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, horse.getLocation(), "HorseInventory")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -697,8 +676,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, horse.getLocation(), "MobRiding")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -708,8 +686,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "MobRiding")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -718,15 +695,13 @@ public class Interact implements Listener {
|
||||
} else if (entity.getType().equals(EntityType.SHEEP)) {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "EntityPlacement")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
} else if (entity.getType().equals(EntityType.ITEM_FRAME)) {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "Storage")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
} else if (entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
|
||||
@ -734,8 +709,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Milking")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -745,8 +719,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Trading")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -755,8 +728,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Storage")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -765,8 +737,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "MinecartBoat")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -775,8 +746,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Hopper")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -784,8 +754,8 @@ public class Interact implements Listener {
|
||||
}
|
||||
|
||||
if (entity.getType() == EntityType.HORSE) {
|
||||
if (!(is.getType() == Material.GOLDEN_APPLE || is.getType() == Material.GOLDEN_CARROT || is.getType() == Material.SUGAR || is.getType() == Material.WHEAT
|
||||
|| is.getType() == Material.APPLE || is.getType() == Material.HAY_BLOCK)) {
|
||||
if (!(is.getType() == Material.GOLDEN_APPLE || is.getType() == Material.GOLDEN_CARROT || is.getType() == Material.SUGAR || is.getType() == Material.WHEAT || is.getType() == Material.APPLE
|
||||
|| is.getType() == Material.HAY_BLOCK)) {
|
||||
return;
|
||||
}
|
||||
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
|
||||
@ -807,10 +777,9 @@ public class Interact implements Listener {
|
||||
}
|
||||
}
|
||||
} else if (entity.getType() == EntityType.WOLF) {
|
||||
if (!(is.getType() == Material.BONE || is.getType() == Materials.PORKCHOP.parseMaterial() || is.getType() == Materials.BEEF.parseMaterial()
|
||||
|| is.getType() == Materials.CHICKEN.parseMaterial() || is.getType() == Material.RABBIT || is.getType() == Material.MUTTON || is.getType() == Material.ROTTEN_FLESH
|
||||
|| is.getType() == Materials.COOKED_PORKCHOP.parseMaterial() || is.getType() == Material.COOKED_BEEF || is.getType() == Material.COOKED_CHICKEN
|
||||
|| is.getType() == Material.COOKED_RABBIT || is.getType() == Material.COOKED_MUTTON)) {
|
||||
if (!(is.getType() == Material.BONE || is.getType() == Materials.PORKCHOP.parseMaterial() || is.getType() == Materials.BEEF.parseMaterial() || is.getType() == Materials.CHICKEN.parseMaterial()
|
||||
|| is.getType() == Material.RABBIT || is.getType() == Material.MUTTON || is.getType() == Material.ROTTEN_FLESH || is.getType() == Materials.COOKED_PORKCHOP.parseMaterial()
|
||||
|| is.getType() == Material.COOKED_BEEF || is.getType() == Material.COOKED_CHICKEN || is.getType() == Material.COOKED_RABBIT || is.getType() == Material.COOKED_MUTTON)) {
|
||||
return;
|
||||
}
|
||||
} else if (entity.getType() == EntityType.OCELOT) {
|
||||
@ -849,8 +818,7 @@ public class Interact implements Listener {
|
||||
if (!islandManager.hasPermission(player, entity.getLocation(), "AnimalBreeding")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -865,8 +833,7 @@ public class Interact implements Listener {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, event.getVehicle().getLocation(), "MobHurting")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -880,8 +847,7 @@ public class Interact implements Listener {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, event.getVehicle().getLocation(), "MobHurting")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -904,8 +870,7 @@ public class Interact implements Listener {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "ArmorStandUse")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ public class Join implements Listener {
|
||||
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile");
|
||||
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
|
||||
Property property = gameProfile.getProperties().get("textures").iterator().next();
|
||||
playerTexture = new String[]{property.getSignature(), property.getValue()};
|
||||
playerTexture = new String[] { property.getSignature(), property.getValue() };
|
||||
} catch (Exception e) {
|
||||
playerTexture = new String[]{
|
||||
playerTexture = new String[] {
|
||||
"K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=",
|
||||
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"};
|
||||
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19" };
|
||||
}
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
@ -99,10 +99,8 @@ public class Join implements Listener {
|
||||
|
||||
playerDataManager.storeIsland(player);
|
||||
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Biome,
|
||||
cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Creation,
|
||||
cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
@ -112,49 +110,30 @@ public class Join implements Listener {
|
||||
if (island != null) {
|
||||
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
|
||||
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Levelling,
|
||||
cooldownManager.loadCooldownPlayer(CooldownType.Levelling, offlinePlayer));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Ownership,
|
||||
cooldownManager.loadCooldownPlayer(CooldownType.Ownership, offlinePlayer));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Levelling, cooldownManager.loadCooldownPlayer(CooldownType.Levelling, offlinePlayer));
|
||||
cooldownManager.addCooldownPlayer(CooldownType.Ownership, cooldownManager.loadCooldownPlayer(CooldownType.Ownership, offlinePlayer));
|
||||
|
||||
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
||||
config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
||||
|
||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
||||
.getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
||||
} else {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
||||
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
||||
}
|
||||
} else {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
||||
|
||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
||||
.getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
||||
} else {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
||||
.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
}
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner",
|
||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator",
|
||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member",
|
||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
}
|
||||
} else {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
||||
config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
||||
scoreboard.setDisplayList(
|
||||
config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
||||
}
|
||||
|
||||
scoreboard.run();
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.songoda.skyblock.localization;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.Configuration;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.localization.type.Localization;
|
||||
import com.songoda.skyblock.localization.type.impl.BlankLocalization;
|
||||
import com.songoda.skyblock.localization.type.impl.EnumLocalization;
|
||||
import com.songoda.skyblock.localization.type.impl.MaterialsLocalization;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
|
||||
public final class LocalizationManager {
|
||||
|
||||
private final Localization<?> def = new BlankLocalization("", Object.class);
|
||||
|
||||
private Map<Class<?>, Localization<?>> map;
|
||||
|
||||
public LocalizationManager() {
|
||||
this.map = new HashMap<>();
|
||||
registerLocalizationFor(Materials.class, new MaterialsLocalization("Materials"));
|
||||
registerLocalizationFor(IslandRole.class, new EnumLocalization<>("IslandRoles", IslandRole.class));
|
||||
}
|
||||
|
||||
public void registerLocalizationFor(Class<?> type, Localization<?> toUse) {
|
||||
|
||||
if (type == null) throw new IllegalArgumentException("type cannot be null");
|
||||
if (toUse == null) throw new IllegalArgumentException("toUse cannot be null");
|
||||
if (toUse == def) throw new IllegalArgumentException("Cannot register default localization.");
|
||||
|
||||
map.put(type, toUse);
|
||||
|
||||
final SkyBlock inst = SkyBlock.getInstance();
|
||||
|
||||
toUse.reload(inst.getFileManager().getConfig(new File(inst.getDataFolder(), "language.yml")).getFileConfiguration().getConfigurationSection(toUse.getKeysPath()));
|
||||
}
|
||||
|
||||
public void reloadAll() {
|
||||
|
||||
final SkyBlock inst = SkyBlock.getInstance();
|
||||
final Configuration config = inst.getFileManager().getConfig(new File(inst.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
|
||||
for (Localization<?> locale : Sets.newHashSet(map.values())) {
|
||||
locale.reload(config.getConfigurationSection(locale.getKeysPath()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Localization<T> getLocalizationFor(Class<T> type) {
|
||||
|
||||
Localization<T> locale = (Localization<T>) map.get(type);
|
||||
|
||||
if (locale == null) locale = (Localization<T>) def;
|
||||
|
||||
return locale;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.songoda.skyblock.localization.type;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public abstract class Localization<T> {
|
||||
|
||||
private final Class<T> type;
|
||||
private final String keysPath;
|
||||
private final Map<T, String> values;
|
||||
|
||||
public Localization(String keysPath, Class<T> type) {
|
||||
this.type = Objects.requireNonNull(type, "type cannot be null");
|
||||
this.keysPath = "ClassLocalization." + Objects.requireNonNull(keysPath, "keysPath canoot be null.");
|
||||
this.values = Objects.requireNonNull(newValueMapInstance(type), "type cannot be null");
|
||||
}
|
||||
|
||||
public abstract void reload(ConfigurationSection section);
|
||||
|
||||
protected abstract Map<T, String> newValueMapInstance(Class<T> type);
|
||||
|
||||
protected final Map<T, String> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public final String getKeysPath() {
|
||||
return keysPath;
|
||||
}
|
||||
|
||||
public final Class<T> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getLocale(T object) {
|
||||
|
||||
String value = getValues().get(object);
|
||||
|
||||
if (value == null) value = getDefaultLocaleFor(object);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getDefaultLocaleFor(T object) {
|
||||
|
||||
String name = object.toString().toLowerCase();
|
||||
|
||||
if (name.length() > 1) name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.songoda.skyblock.localization.type.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.songoda.skyblock.localization.type.Localization;
|
||||
|
||||
public final class BlankLocalization extends Localization<Object> {
|
||||
|
||||
public BlankLocalization(String keysPath, Class<Object> type) {
|
||||
super(keysPath, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(ConfigurationSection section) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<Object, String> newValueMapInstance(Class<Object> type) {
|
||||
return new HashMap<>(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocale(Object obj) {
|
||||
return getDefaultLocaleFor(obj);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.songoda.skyblock.localization.type.impl;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.songoda.skyblock.localization.type.Localization;
|
||||
|
||||
public class EnumLocalization<T extends Enum<T>> extends Localization<T> {
|
||||
|
||||
public EnumLocalization(String keysPath, Class<T> type) {
|
||||
super(keysPath, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Map<T, String> newValueMapInstance(Class<T> type) {
|
||||
return new EnumMap<>(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(ConfigurationSection section) {
|
||||
|
||||
getValues().clear();
|
||||
|
||||
if (section == null) return;
|
||||
|
||||
for (String key : section.getKeys(false)) {
|
||||
T parse;
|
||||
|
||||
try {
|
||||
parse = parseEnum(key);
|
||||
} catch (IllegalArgumentException | NullPointerException e) {
|
||||
throw new IllegalArgumentException("Unable to parse a '" + getType().getSimpleName() + "' for given string '" + key + "' in '" + section.getCurrentPath() + "'", e);
|
||||
}
|
||||
|
||||
getValues().put(parse, section.getString(key));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected T parseEnum(String input) {
|
||||
return Enum.valueOf(getType(), input);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.skyblock.localization.type.impl;
|
||||
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
|
||||
public class MaterialsLocalization extends EnumLocalization<Materials> {
|
||||
|
||||
public MaterialsLocalization(String keysPath) {
|
||||
super(keysPath, Materials.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Materials parseEnum(String input) {
|
||||
return Materials.fromString(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLocaleFor(Materials obj) {
|
||||
return super.getDefaultLocaleFor(obj).replace("_", " ");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.songoda.skyblock.localization.type.impl;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
|
||||
public class MaterialsToMaterialLocalization extends EnumLocalization<Material> {
|
||||
|
||||
public MaterialsToMaterialLocalization(String keysPath) {
|
||||
super(keysPath, Material.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material parseEnum(String input) {
|
||||
Materials material = Materials.fromString(input);
|
||||
return material == null ? null : material.parseMaterial();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,21 @@
|
||||
package com.songoda.skyblock.menus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
@ -21,23 +37,8 @@ import com.songoda.skyblock.utils.item.MaterialUtil;
|
||||
import com.songoda.skyblock.utils.item.SkullUtil;
|
||||
import com.songoda.skyblock.utils.item.nInventoryUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Levelling {
|
||||
|
||||
@ -64,8 +65,7 @@ public class Levelling {
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
FileConfiguration configLoad = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration();
|
||||
FileConfiguration configLoad = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
|
||||
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
||||
if (islandManager.getIsland(player) == null) {
|
||||
@ -80,110 +80,95 @@ public class Levelling {
|
||||
ItemStack is = event.getItem();
|
||||
|
||||
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"))))) {
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Exit.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
|
||||
} else if ((is.getType() == Material.PAINTING) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Exit.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
|
||||
} else
|
||||
if ((is.getType() == Material.PAINTING) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
} else if ((is.getType() == Material.BARRIER) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
} else
|
||||
if ((is.getType() == Material.BARRIER) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"))))) {
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
} else if ((is.getType() == Materials.FIREWORK_STAR.parseMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"))))) {
|
||||
Island island = islandManager.getIsland(player);
|
||||
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
} else
|
||||
if ((is.getType() == Materials.FIREWORK_STAR.parseMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"))))) {
|
||||
Island island = islandManager.getIsland(player);
|
||||
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
|
||||
|
||||
if (cooldownManager.hasPlayer(CooldownType.Levelling, offlinePlayer) && !player.hasPermission("fabledskyblock.bypass.cooldown")) {
|
||||
CooldownPlayer cooldownPlayer = cooldownManager
|
||||
.getCooldownPlayer(CooldownType.Levelling, offlinePlayer);
|
||||
Cooldown cooldown = cooldownPlayer.getCooldown();
|
||||
if (cooldownManager.hasPlayer(CooldownType.Levelling, offlinePlayer) && !player.hasPermission("fabledskyblock.bypass.cooldown")) {
|
||||
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Levelling, offlinePlayer);
|
||||
Cooldown cooldown = cooldownPlayer.getCooldown();
|
||||
|
||||
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
|
||||
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
|
||||
|
||||
if (cooldown.getTime() >= 3600) {
|
||||
messageManager.sendMessage(player, configLoad
|
||||
.getString("Command.Island.Level.Cooldown.Message")
|
||||
.replace("%time", durationTime[1] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute")
|
||||
+ " " + durationTime[2] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute")
|
||||
+ " " + durationTime[3] + " " + configLoad
|
||||
.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
} else if (cooldown.getTime() >= 60) {
|
||||
messageManager.sendMessage(player, configLoad
|
||||
.getString("Command.Island.Level.Cooldown.Message")
|
||||
.replace("%time", durationTime[2] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute")
|
||||
+ " " + durationTime[3] + " " + configLoad
|
||||
.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
} else {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Cooldown.Message")
|
||||
.replace("%time", cooldown.getTime() + " " + configLoad
|
||||
.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
}
|
||||
if (cooldown.getTime() >= 3600) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time",
|
||||
durationTime[1] + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[2] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[3] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
} else if (cooldown.getTime() >= 60) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time", durationTime[2] + " "
|
||||
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[3] + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time",
|
||||
cooldown.getTime() + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Processing.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Processing.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
cooldownManager.createPlayer(CooldownType.Levelling,
|
||||
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
|
||||
levellingManager.startScan(player, island);
|
||||
});
|
||||
} else if ((is.getType() == SkullUtil.createItemStack().getType()) && (is.hasItemMeta())) {
|
||||
PlayerData playerData1 = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
cooldownManager.createPlayer(CooldownType.Levelling, Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
|
||||
levellingManager.startScan(player, island);
|
||||
});
|
||||
} else
|
||||
if ((is.getType() == SkullUtil.createItemStack().getType()) && (is.hasItemMeta())) {
|
||||
PlayerData playerData1 = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Levelling.Item.Previous.Displayname")))) {
|
||||
playerData1.setPage(playerData1.getPage() - 1);
|
||||
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Previous.Displayname")))) {
|
||||
playerData1.setPage(playerData1.getPage() - 1);
|
||||
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
|
||||
} else if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes(
|
||||
'&', configLoad.getString("Menu.Levelling.Item.Next.Displayname")))) {
|
||||
playerData1.setPage(playerData1.getPage() + 1);
|
||||
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
|
||||
} else if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Next.Displayname")))) {
|
||||
playerData1.setPage(playerData1.getPage() + 1);
|
||||
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
|
||||
} else {
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
|
||||
} else {
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
}
|
||||
} else {
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
}
|
||||
} else {
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
}
|
||||
event.setWillClose(false);
|
||||
event.setWillDestroy(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -200,11 +185,8 @@ public class Levelling {
|
||||
// Filter out ItemStacks that can't be displayed in the inventory
|
||||
Inventory testInventory = Bukkit.createInventory(null, 9);
|
||||
for (String materialName : testIslandMaterialKeysOrdered) {
|
||||
if (mainConfig.getFileConfiguration().getString("Materials." + materialName + ".Points") == null)
|
||||
continue;
|
||||
if (!settingsConfig.getFileConfiguration().getBoolean("Island.Levelling.IncludeEmptyPointsInList") &&
|
||||
mainConfig.getFileConfiguration().getInt("Materials." + materialName + ".Points") <= 0)
|
||||
continue;
|
||||
if (mainConfig.getFileConfiguration().getString("Materials." + materialName + ".Points") == null) continue;
|
||||
if (!settingsConfig.getFileConfiguration().getBoolean("Island.Levelling.IncludeEmptyPointsInList") && mainConfig.getFileConfiguration().getInt("Materials." + materialName + ".Points") <= 0) continue;
|
||||
|
||||
long value = testIslandMaterials.get(materialName);
|
||||
Materials materials = Materials.fromString(materialName);
|
||||
@ -224,25 +206,14 @@ public class Levelling {
|
||||
|
||||
int playerMenuPage = playerData.getPage(), nextEndIndex = islandMaterials.size() - playerMenuPage * 36;
|
||||
|
||||
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(), configLoad.getString("Menu.Levelling.Item.Exit.Displayname"), null, null, null, null), 0, 8);
|
||||
nInv.addItem(nInv.createItem(Materials.FIREWORK_STAR.parseItem(), configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Rescan.Lore"), null, null,
|
||||
new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 3, 5);
|
||||
nInv.addItem(
|
||||
nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
|
||||
configLoad.getString("Menu.Levelling.Item.Exit.Displayname"), null, null, null, null),
|
||||
0, 8);
|
||||
nInv.addItem(nInv.createItem(Materials.FIREWORK_STAR.parseItem(),
|
||||
configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"),
|
||||
configLoad.getStringList("Menu.Levelling.Item.Rescan.Lore"), null, null,
|
||||
new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 3, 5);
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
|
||||
configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"),
|
||||
configLoad.getStringList("Menu.Levelling.Item.Statistics.Lore"),
|
||||
new Placeholder[]{
|
||||
new Placeholder("%level_points", NumberUtil.formatNumberByDecimal(level.getPoints())),
|
||||
new Placeholder("%level", NumberUtil.formatNumberByDecimal(level.getLevel()))},
|
||||
null, null), 4);
|
||||
nInv.addItem(
|
||||
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
|
||||
configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null),
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17);
|
||||
nInv.createItem(new ItemStack(Material.PAINTING), configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Statistics.Lore"),
|
||||
new Placeholder[] { new Placeholder("%level_points", NumberUtil.formatNumberByDecimal(level.getPoints())), new Placeholder("%level", NumberUtil.formatNumberByDecimal(level.getLevel())) }, null, null),
|
||||
4);
|
||||
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
|
||||
|
||||
if (playerMenuPage != 1) {
|
||||
nInv.addItem(nInv.createItem(SkullUtil.create(
|
||||
@ -259,12 +230,9 @@ public class Levelling {
|
||||
}
|
||||
|
||||
if (islandMaterials.size() == 0) {
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.BARRIER),
|
||||
configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"), null, null, null, null), 31);
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.BARRIER), configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"), null, null, null, null), 31);
|
||||
} else {
|
||||
int index = playerMenuPage * 36 - 36,
|
||||
endIndex = index >= islandMaterials.size() ? islandMaterials.size() - 1 : index + 36,
|
||||
inventorySlot = 17;
|
||||
int index = playerMenuPage * 36 - 36, endIndex = index >= islandMaterials.size() ? islandMaterials.size() - 1 : index + 36, inventorySlot = 17;
|
||||
|
||||
for (; index < endIndex; index++) {
|
||||
if (islandMaterials.size() > index) {
|
||||
@ -282,28 +250,19 @@ public class Levelling {
|
||||
|
||||
long pointsEarned = materialAmount * pointsMultiplier;
|
||||
|
||||
String name = skyblock.getLocalizationManager().getLocalizationFor(Materials.class).getLocale(materials);
|
||||
|
||||
if (materials == Materials.FARMLAND && NMSUtil.getVersionNumber() < 9) materials = Materials.DIRT;
|
||||
|
||||
ItemStack is = materials.parseItem();
|
||||
is.setAmount(Math.min(Math.toIntExact(materialAmount), 64));
|
||||
is.setType(MaterialUtil.correctMaterial(is.getType()));
|
||||
|
||||
String name;
|
||||
if (materials.isSpawner() && materials != Materials.SPAWNER) {
|
||||
name = "Spawner: " + WordUtils.capitalize(material.replace("SPAWNER_", "").toLowerCase().replace("_", " ")).trim();
|
||||
} else {
|
||||
name = WordUtils.capitalize(material.toLowerCase().replace("_", " ")).trim();
|
||||
}
|
||||
|
||||
List<String> lore = configLoad.getStringList("Menu.Levelling.Item.Material.Lore");
|
||||
lore.replaceAll(x -> x.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned))
|
||||
.replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount))
|
||||
.replace("%material", name));
|
||||
lore.replaceAll(x -> x.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned)).replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name));
|
||||
|
||||
nInv.addItem(nInv.createItem(is, configLoad
|
||||
.getString("Menu.Levelling.Item.Material.Displayname")
|
||||
.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned))
|
||||
.replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount))
|
||||
.replace("%material", name),
|
||||
lore, null, null, null), inventorySlot);
|
||||
nInv.addItem(nInv.createItem(is, configLoad.getString("Menu.Levelling.Item.Material.Displayname").replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned))
|
||||
.replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name), lore, null, null, null), inventorySlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,7 @@ public class MessageManager {
|
||||
|
||||
public void sendMessage(CommandSender sender, String message) {
|
||||
|
||||
if (message == null) {
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
return;
|
||||
}
|
||||
if (message == null) return;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
|
@ -146,7 +146,7 @@ public class PlaceholderManager {
|
||||
if (island.hasRole(roleList, player.getUniqueId())) {
|
||||
return ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Placeholder.fabledskyblock_island_role.Non-empty.Message")
|
||||
.replace("%placeholder", roleList.name()));
|
||||
.replace("%placeholder", skyblock.getLocalizationManager().getLocalizationFor(IslandRole.class).getLocale(roleList)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,12 +205,7 @@ public class PlayerDataManager {
|
||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Scoreboard.Island.Team.Displayname")));
|
||||
scoreboard.setDisplayList(configLoad.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner", configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member", configLoad.getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
}
|
||||
|
||||
scoreboard.run();
|
||||
|
@ -20,6 +20,7 @@ import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.localization.type.Localization;
|
||||
import com.songoda.skyblock.placeholder.PlaceholderManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
@ -31,14 +32,13 @@ public class Scoreboard {
|
||||
|
||||
private String displayName;
|
||||
private List<String> displayList;
|
||||
private Map<String, String> displayVariables;
|
||||
|
||||
private BukkitTask scheduler;
|
||||
|
||||
public Scoreboard(SkyBlock plugin, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
displayList = new ArrayList<>();
|
||||
displayVariables = new HashMap<>();
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
@ -49,10 +49,6 @@ public class Scoreboard {
|
||||
this.displayList = displayList;
|
||||
}
|
||||
|
||||
public void setDisplayVariables(Map<String, String> displayVariables) {
|
||||
this.displayVariables = displayVariables;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (scheduler != null) scheduler.cancel();
|
||||
|
||||
@ -135,8 +131,7 @@ public class Scoreboard {
|
||||
String lastColorCodeText = colorCodes[colorCodes.length - 1];
|
||||
lastColorCodes = "&" + lastColorCodeText.substring(0, Math.min(lastColorCodeText.length(), 1));
|
||||
|
||||
if ((colorCodes.length >= 2)
|
||||
&& (lastColorCodes.equals("&l") || lastColorCodes.equals("&m") || lastColorCodes.equals("&n") || lastColorCodes.equals("&o"))) {
|
||||
if ((colorCodes.length >= 2) && (lastColorCodes.equals("&l") || lastColorCodes.equals("&m") || lastColorCodes.equals("&n") || lastColorCodes.equals("&o"))) {
|
||||
lastColorCodeText = colorCodes[colorCodes.length - 2];
|
||||
lastColorCodes = "&" + lastColorCodeText.substring(0, Math.min(lastColorCodeText.length(), 1)) + lastColorCodes;
|
||||
}
|
||||
@ -188,29 +183,30 @@ public class Scoreboard {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel())).replace("%island_members", ChatColor.RED + "0")
|
||||
.replace("%island_role", ChatColor.RED + "null").replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size())
|
||||
.replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel())).replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null")
|
||||
.replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size()).replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||
} else {
|
||||
int islandMembers = 1 + island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size();
|
||||
String islandRole = "";
|
||||
|
||||
|
||||
Localization<IslandRole> locale = skyblock.getLocalizationManager().getLocalizationFor(IslandRole.class);
|
||||
|
||||
if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
islandRole = displayVariables.get("%owner");
|
||||
islandRole = locale.getLocale(IslandRole.Owner);
|
||||
} else if (island.hasRole(IslandRole.Operator, player.getUniqueId())) {
|
||||
islandRole = displayVariables.get("%operator");
|
||||
islandRole = locale.getLocale(IslandRole.Operator);
|
||||
} else if (island.hasRole(IslandRole.Member, player.getUniqueId())) {
|
||||
islandRole = displayVariables.get("%member");
|
||||
islandRole = locale.getLocale(IslandRole.Member);;
|
||||
}
|
||||
|
||||
displayLine = displayLine.replace("%island_points", "" + NumberUtil.formatNumberByDecimal(level.getPoints()))
|
||||
.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel())).replace("%island_members", "" + islandMembers).replace("%island_role", islandRole)
|
||||
.replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size()).replace("%island_size", "" + island.getSize())
|
||||
.replace("%island_radius", "" + island.getRadius());
|
||||
displayLine = displayLine.replace("%island_points", "" + NumberUtil.formatNumberByDecimal(level.getPoints())).replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel()))
|
||||
.replace("%island_members", "" + islandMembers).replace("%island_role", islandRole).replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size())
|
||||
.replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||
}
|
||||
} else {
|
||||
displayLine = displayLine.replace("%island_points", ChatColor.RED + "0").replace("%island_level", ChatColor.RED + "0").replace("%island_members", ChatColor.RED + "0")
|
||||
.replace("%island_role", ChatColor.RED + "null").replace("%island_size", ChatColor.RED + "0").replace("%island_radius", ChatColor.RED + "0");
|
||||
displayLine = displayLine.replace("%island_points", ChatColor.RED + "0").replace("%island_level", ChatColor.RED + "0").replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null")
|
||||
.replace("%island_size", ChatColor.RED + "0").replace("%island_radius", ChatColor.RED + "0");
|
||||
}
|
||||
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
|
@ -80,12 +80,7 @@ public class ScoreboardManager extends BukkitRunnable {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
}
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,12 +224,6 @@ public class ScoreboardManager extends BukkitRunnable {
|
||||
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||
}
|
||||
|
||||
Map<String, String> displayVariables = new HashMap<>();
|
||||
displayVariables.put("%owner", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
||||
displayVariables.put("%operator", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
||||
displayVariables.put("%member", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
||||
|
||||
scoreboard.setDisplayVariables(displayVariables);
|
||||
}
|
||||
}
|
||||
scoreboard.run();
|
||||
|
@ -1,35 +1,34 @@
|
||||
package com.songoda.skyblock.stackable;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
|
||||
public class Stackable {
|
||||
|
||||
private UUID uuid;
|
||||
|
||||
private Location location;
|
||||
private Material material;
|
||||
private Materials material;
|
||||
private int size = 2;
|
||||
private ArmorStand display;
|
||||
|
||||
public Stackable(Location location, Material material) {
|
||||
public Stackable(Location location, Materials material) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
this.material = material;
|
||||
@ -38,7 +37,7 @@ public class Stackable {
|
||||
this.save();
|
||||
}
|
||||
|
||||
public Stackable(UUID uuid, Location location, Material material, int size) {
|
||||
public Stackable(UUID uuid, Location location, Materials material, int size) {
|
||||
this.uuid = uuid;
|
||||
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
this.material = material;
|
||||
@ -58,11 +57,11 @@ public class Stackable {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
public Materials getMaterial() {
|
||||
return this.material;
|
||||
}
|
||||
|
||||
public void setMaterial(Material material) {
|
||||
public void setMaterial(Materials material) {
|
||||
this.material = material;
|
||||
this.save();
|
||||
}
|
||||
@ -122,7 +121,7 @@ public class Stackable {
|
||||
as.setMarker(true);
|
||||
}
|
||||
as.setBasePlate(true);
|
||||
as.setHelmet(new ItemStack(this.material));
|
||||
as.setHelmet(material.parseItem());
|
||||
as.setCustomName(this.getCustomName());
|
||||
as.setCustomNameVisible(true);
|
||||
as.setMetadata("StackableArmorStand", new FixedMetadataValue(SkyBlock.getInstance(), ""));
|
||||
@ -141,8 +140,7 @@ public class Stackable {
|
||||
|
||||
private void save() {
|
||||
File configFile = new File(SkyBlock.getInstance().getDataFolder().toString() + "/island-data");
|
||||
FileManager.Config config = SkyBlock.getInstance().getFileManager()
|
||||
.getConfig(new File(configFile, SkyBlock.getInstance().getIslandManager().getIslandAtLocation(this.location).getOwnerUUID() + ".yml"));
|
||||
FileManager.Config config = SkyBlock.getInstance().getFileManager().getConfig(new File(configFile, SkyBlock.getInstance().getIslandManager().getIslandAtLocation(this.location).getOwnerUUID() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (this.getSize() == 0) {
|
||||
@ -150,16 +148,13 @@ public class Stackable {
|
||||
} else {
|
||||
ConfigurationSection section = configLoad.createSection("Stackables." + this.getUuid().toString());
|
||||
section.set("Location", this.getLocation());
|
||||
section.set("Material", this.getMaterial().name());
|
||||
section.set("Size", this.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
private String getCustomName() {
|
||||
return ChatColor
|
||||
.translateAlternateColorCodes('&',
|
||||
SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Hologram.Stackable.Message"))
|
||||
.replace("%block", WordUtils.capitalize(this.material.name().toLowerCase()).replace("_", " ")).replace("%amount", NumberUtil.formatNumber(this.size));
|
||||
.translateAlternateColorCodes('&', SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration().getString("Hologram.Stackable.Message"))
|
||||
.replace("%block", SkyBlock.getInstance().getLocalizationManager().getLocalizationFor(Materials.class).getLocale(material)).replace("%amount", NumberUtil.formatNumber(this.size));
|
||||
}
|
||||
}
|
||||
|
@ -11,18 +11,20 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
|
||||
public class StackableManager {
|
||||
|
||||
// ToDO: Should pobably be a GUI for this
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private Set<Material> stackableMaterials = EnumSet.noneOf(Material.class);
|
||||
private Set<Materials> stackableMaterials = EnumSet.noneOf(Materials.class);
|
||||
private Map<Location, Stackable> stacks = new HashMap<>();
|
||||
|
||||
public StackableManager(SkyBlock skyblock) {
|
||||
@ -39,45 +41,77 @@ public class StackableManager {
|
||||
|
||||
for (String stackableStr : stackableList) {
|
||||
try {
|
||||
this.stackableMaterials.add(Material.valueOf(stackableStr));
|
||||
this.stackableMaterials.add(Materials.fromString(stackableStr));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* public void loadSavedStackables() { FileManager fileManager =
|
||||
* SkyBlock.getInstance().getFileManager(); String path =
|
||||
* SkyBlock.getInstance().getDataFolder().toString() + "/island-data"; File[]
|
||||
* files = new File(path).listFiles(); if (files == null) return; for (File file
|
||||
* : files) { File configFile = new File(path); FileManager.Config config =
|
||||
* fileManager.getConfig(new File(configFile, file.getName()));
|
||||
* FileConfiguration configLoad = config.getFileConfiguration();
|
||||
* ConfigurationSection cs = configLoad.getConfigurationSection("Stackables");
|
||||
* if (cs == null) continue; Set<String> keys = cs.getKeys(false); if (keys ==
|
||||
* null) continue; for (String uuid : keys) { ConfigurationSection section =
|
||||
* cs.getConfigurationSection(uuid); Location location = (Location)
|
||||
* section.get("Location"); org.bukkit.Material material =
|
||||
* org.bukkit.Material.valueOf(section.getString("Material")); int size =
|
||||
* section.getInt("Size"); if (size == 0) continue; this.addStack(new
|
||||
* Stackable(UUID.fromString(uuid), location, material, size)); } } }
|
||||
*/
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void loadSavedStackables() {
|
||||
FileManager fileManager = SkyBlock.getInstance().getFileManager();
|
||||
String path = SkyBlock.getInstance().getDataFolder().toString() + "/island-data";
|
||||
File[] files = new File(path).listFiles();
|
||||
final File path = new File(skyblock.getDataFolder(), "island-data");
|
||||
final File[] files = path.listFiles();
|
||||
|
||||
if (files == null) return;
|
||||
|
||||
for (File file : files) {
|
||||
File configFile = new File(path);
|
||||
FileManager.Config config = fileManager.getConfig(new File(configFile, file.getName()));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
ConfigurationSection cs = configLoad.getConfigurationSection("Stackables");
|
||||
if (cs == null) continue;
|
||||
Set<String> keys = cs.getKeys(false);
|
||||
if (keys == null) continue;
|
||||
for (String uuid : keys) {
|
||||
ConfigurationSection section = cs.getConfigurationSection(uuid);
|
||||
Location location = (Location) section.get("Location");
|
||||
org.bukkit.Material material = org.bukkit.Material.valueOf(section.getString("Material"));
|
||||
int size = section.getInt("Size");
|
||||
final FileConfiguration config = skyblock.getFileManager().getConfig(file).getFileConfiguration();
|
||||
|
||||
ConfigurationSection stackableSection = config.getConfigurationSection("Stackables");
|
||||
|
||||
if (stackableSection == null) continue;
|
||||
|
||||
for (String key : stackableSection.getKeys(false)) {
|
||||
|
||||
final ConfigurationSection currentSection = stackableSection.getConfigurationSection(key);
|
||||
final Location loc = (Location) currentSection.get("Location");
|
||||
final Block block = loc.getWorld().getBlockAt(loc);
|
||||
|
||||
if (block.getType() == Material.AIR) continue;
|
||||
|
||||
final Materials type = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
if (type == null) continue;
|
||||
|
||||
final int size = currentSection.getInt("Size");
|
||||
|
||||
if (size == 0) continue;
|
||||
this.addStack(new Stackable(UUID.fromString(uuid), location, material, size));
|
||||
|
||||
this.addStack(new Stackable(UUID.fromString(key), loc, type, size));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void unregisterStackables() {
|
||||
stackableMaterials.clear();
|
||||
}
|
||||
|
||||
public Set<Material> getStackableMaterials() {
|
||||
public Set<Materials> getStackableMaterials() {
|
||||
return Collections.unmodifiableSet(stackableMaterials);
|
||||
}
|
||||
|
||||
public boolean isStackableMaterial(Material material) {
|
||||
public boolean isStackableMaterial(Materials material) {
|
||||
return stackableMaterials.contains(material);
|
||||
}
|
||||
|
||||
@ -89,7 +123,7 @@ public class StackableManager {
|
||||
return stacks.containsKey(location);
|
||||
}
|
||||
|
||||
public Stackable getStack(Location location, Material material) {
|
||||
public Stackable getStack(Location location, Materials material) {
|
||||
Stackable stackable = stacks.get(location);
|
||||
|
||||
return stackable != null && stackable.getMaterial() == material ? stackable : null;
|
||||
@ -104,7 +138,7 @@ public class StackableManager {
|
||||
stacks.remove(stackable.getLocation());
|
||||
}
|
||||
|
||||
public long getStackSizeOf(Location loc, Material type) {
|
||||
public long getStackSizeOf(Location loc, Materials type) {
|
||||
final Stackable stack = getStack(loc, type);
|
||||
|
||||
return stack == null ? 0 : stack.getSize();
|
||||
|
@ -45,8 +45,6 @@ public final class UserCacheManager {
|
||||
final FileConfiguration configLoad = new Config(fileManager, fileList).getFileConfiguration();
|
||||
final String ownerUUIDString = fileName.substring(0, fileName.indexOf('.'));
|
||||
|
||||
System.out.println(ownerUUIDString);
|
||||
|
||||
Set<UUID> islandMembers = new HashSet<>();
|
||||
islandMembers.add(UUID.fromString(ownerUUIDString));
|
||||
|
||||
@ -76,8 +74,7 @@ public final class UserCacheManager {
|
||||
save();
|
||||
|
||||
if (usersIgnored != 0) {
|
||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
||||
"SkyBlock | Info: Finished fetching user information from island data. There were " + usersIgnored + " users that were skipped.");
|
||||
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Finished fetching user information from island data. There were " + usersIgnored + " users that were skipped.");
|
||||
} else {
|
||||
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Finished fetching user information from island data. No users were ignored.");
|
||||
}
|
||||
|
@ -33,10 +33,12 @@ import java.util.zip.GZIPOutputStream;
|
||||
public class Metrics {
|
||||
|
||||
static {
|
||||
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
|
||||
// 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' });
|
||||
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
|
||||
// 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!");
|
||||
}
|
||||
@ -87,15 +89,12 @@ public class Metrics {
|
||||
config.addDefault("logFailedRequests", 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);
|
||||
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 (IOException ignored) { }
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
// Load the data
|
||||
@ -109,7 +108,8 @@ public class Metrics {
|
||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||
found = true; // We aren't the first
|
||||
break;
|
||||
} catch (NoSuchFieldException ignored) { }
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
}
|
||||
}
|
||||
// Register our service
|
||||
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
||||
@ -144,8 +144,10 @@ public class Metrics {
|
||||
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 ;)
|
||||
// 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, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -153,15 +155,16 @@ public class Metrics {
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 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!
|
||||
}, 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.
|
||||
* Gets the plugin specific data. This method is called using Reflection.
|
||||
*
|
||||
* @return The plugin specific data.
|
||||
*/
|
||||
@ -240,7 +243,8 @@ public class Metrics {
|
||||
// Found one!
|
||||
try {
|
||||
pluginData.put(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service)));
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { }
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
data.put("plugins", pluginData);
|
||||
@ -411,8 +415,8 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the values of the pie.
|
||||
*
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
||||
* You don't have to create a map yourself!
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||
* life easier. You don't have to create a map yourself!
|
||||
* @return The values of the pie.
|
||||
*/
|
||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||
@ -495,8 +499,8 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the values of the chart.
|
||||
*
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
||||
* You don't have to create a map yourself!
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||
* life easier. You don't have to create a map yourself!
|
||||
* @return The values of the chart.
|
||||
*/
|
||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||
@ -545,8 +549,8 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the value of the chart.
|
||||
*
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
||||
* You don't have to create a map yourself!
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||
* life easier. You don't have to create a map yourself!
|
||||
* @return The value of the chart.
|
||||
*/
|
||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||
@ -588,8 +592,8 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the value of the chart.
|
||||
*
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
||||
* You don't have to create a map yourself!
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||
* life easier. You don't have to create a map yourself!
|
||||
* @return The value of the chart.
|
||||
*/
|
||||
public abstract HashMap<String, int[]> getValues(HashMap<String, int[]> valueMap);
|
||||
@ -678,8 +682,8 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the value of the chart.
|
||||
*
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
||||
* You don't have to create a map yourself!
|
||||
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||
* life easier. You don't have to create a map yourself!
|
||||
* @return The value of the chart.
|
||||
*/
|
||||
public abstract HashMap<Country, Integer> getValues(HashMap<Country, Integer> valueMap);
|
||||
@ -736,7 +740,7 @@ public class Metrics {
|
||||
AUSTRIA("AT", "Austria"),
|
||||
AUSTRALIA("AU", "Australia"),
|
||||
ARUBA("AW", "Aruba"),
|
||||
ALAND_ISLANDS("AX", "Åland Islands"),
|
||||
ALAND_ISLANDS("AX", "<EFBFBD>land Islands"),
|
||||
AZERBAIJAN("AZ", "Azerbaijan"),
|
||||
BOSNIA_AND_HERZEGOVINA("BA", "Bosnia and Herzegovina"),
|
||||
BARBADOS("BB", "Barbados"),
|
||||
@ -747,7 +751,7 @@ public class Metrics {
|
||||
BAHRAIN("BH", "Bahrain"),
|
||||
BURUNDI("BI", "Burundi"),
|
||||
BENIN("BJ", "Benin"),
|
||||
SAINT_BARTHELEMY("BL", "Saint Barthélemy"),
|
||||
SAINT_BARTHELEMY("BL", "Saint Barth<EFBFBD>lemy"),
|
||||
BERMUDA("BM", "Bermuda"),
|
||||
BRUNEI("BN", "Brunei"),
|
||||
BOLIVIA("BO", "Bolivia"),
|
||||
@ -765,7 +769,7 @@ public class Metrics {
|
||||
CENTRAL_AFRICAN_REPUBLIC("CF", "Central African Republic"),
|
||||
CONGO("CG", "Congo"),
|
||||
SWITZERLAND("CH", "Switzerland"),
|
||||
COTE_D_IVOIRE("CI", "Côte d'Ivoire"),
|
||||
COTE_D_IVOIRE("CI", "C<EFBFBD>te d'Ivoire"),
|
||||
COOK_ISLANDS("CK", "Cook Islands"),
|
||||
CHILE("CL", "Chile"),
|
||||
CAMEROON("CM", "Cameroon"),
|
||||
@ -774,7 +778,7 @@ public class Metrics {
|
||||
COSTA_RICA("CR", "Costa Rica"),
|
||||
CUBA("CU", "Cuba"),
|
||||
CAPE_VERDE("CV", "Cape Verde"),
|
||||
CURACAO("CW", "Curaçao"),
|
||||
CURACAO("CW", "Cura<EFBFBD>ao"),
|
||||
CHRISTMAS_ISLAND("CX", "Christmas Island"),
|
||||
CYPRUS("CY", "Cyprus"),
|
||||
CZECH_REPUBLIC("CZ", "Czech Republic"),
|
||||
@ -1017,8 +1021,8 @@ public class Metrics {
|
||||
* Gets a country by a locale.
|
||||
*
|
||||
* @param locale The locale.
|
||||
* @return The country from the giben locale or <code>null</code> if unknown country or
|
||||
* if the locale does not contain a country.
|
||||
* @return The country from the giben locale or <code>null</code> if unknown
|
||||
* country or if the locale does not contain a country.
|
||||
*/
|
||||
public static Country byLocale(Locale locale) {
|
||||
return byIsoTag(locale.getCountry());
|
||||
|
@ -57,7 +57,6 @@ public final class MenuClickRegistry {
|
||||
@SuppressWarnings("deprecation")
|
||||
final MenuExecutor executor = executors.get(RegistryKey.fromName(meta.getDisplayName(), Materials.getMaterials(item.getType(), (byte) item.getDurability())));
|
||||
|
||||
System.out.println(executors.size());
|
||||
|
||||
if (executor == null) return;
|
||||
|
||||
|
@ -36,15 +36,13 @@ import java.util.logging.Level;
|
||||
|
||||
public final class StructureUtil {
|
||||
|
||||
public static void saveStructure(File configFile, org.bukkit.Location originLocation,
|
||||
org.bukkit.Location[] positions) throws Exception {
|
||||
public static void saveStructure(File configFile, org.bukkit.Location originLocation, org.bukkit.Location[] positions) throws Exception {
|
||||
if (!configFile.exists()) {
|
||||
configFile.createNewFile();
|
||||
}
|
||||
|
||||
LinkedHashMap<Block, Location> blocks = SelectionLocation.getBlocks(originLocation, positions[0], positions[1]);
|
||||
LinkedHashMap<Entity, Location> entities = SelectionLocation.getEntities(originLocation, positions[0],
|
||||
positions[1]);
|
||||
LinkedHashMap<Entity, Location> entities = SelectionLocation.getEntities(originLocation, positions[0], positions[1]);
|
||||
|
||||
List<BlockData> blockData = new ArrayList<>();
|
||||
List<EntityData> entityData = new ArrayList<>();
|
||||
@ -55,12 +53,10 @@ public final class StructureUtil {
|
||||
Location location = blocks.get(blockList);
|
||||
|
||||
if (location.isOriginLocation()) {
|
||||
originBlockLocation = location.getX() + ":" + location.getY() + ":" + location.getZ() + ":"
|
||||
+ positions[0].getWorld().getName();
|
||||
originBlockLocation = location.getX() + ":" + location.getY() + ":" + location.getZ() + ":" + positions[0].getWorld().getName();
|
||||
|
||||
if (blockList.getType() == Material.AIR) {
|
||||
blockData.add(BlockUtil.convertBlockToBlockData(blockList, location.getX(), location.getY(),
|
||||
location.getZ()));
|
||||
blockData.add(BlockUtil.convertBlockToBlockData(blockList, location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,8 +64,7 @@ public final class StructureUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
blockData.add(
|
||||
BlockUtil.convertBlockToBlockData(blockList, location.getX(), location.getY(), location.getZ()));
|
||||
blockData.add(BlockUtil.convertBlockToBlockData(blockList, location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
||||
for (Entity entityList : entities.keySet()) {
|
||||
@ -78,16 +73,14 @@ public final class StructureUtil {
|
||||
}
|
||||
|
||||
Location location = entities.get(entityList);
|
||||
entityData.add(EntityUtil.convertEntityToEntityData(entityList, location.getX(), location.getY(),
|
||||
location.getZ()));
|
||||
entityData.add(EntityUtil.convertEntityToEntityData(entityList, location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
||||
if (!originBlockLocation.isEmpty()) {
|
||||
originBlockLocation = originBlockLocation + ":" + originLocation.getYaw() + ":" + originLocation.getPitch();
|
||||
}
|
||||
|
||||
String JSONString = new Gson().toJson(new Storage(new Gson().toJson(blockData), new Gson().toJson(entityData),
|
||||
originBlockLocation, System.currentTimeMillis(), NMSUtil.getVersionNumber()), Storage.class);
|
||||
String JSONString = new Gson().toJson(new Storage(new Gson().toJson(blockData), new Gson().toJson(entityData), originBlockLocation, System.currentTimeMillis(), NMSUtil.getVersionNumber()), Storage.class);
|
||||
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(configFile, false);
|
||||
fileOutputStream.write(Base64.getEncoder().encode(JSONString.getBytes(StandardCharsets.UTF_8)));
|
||||
@ -113,10 +106,8 @@ public final class StructureUtil {
|
||||
String base64 = getBase64String(configFile);
|
||||
|
||||
if (base64 == null) {
|
||||
base64 = getBase64String(
|
||||
new File(SkyBlock.getInstance().getDataFolder() + "/" + "structures", "default.structure"));
|
||||
SkyBlock.getInstance().getLogger().log(Level.SEVERE,
|
||||
"Unable to load structure '" + configFile.getAbsolutePath() + "' using default instead.");
|
||||
base64 = getBase64String(new File(SkyBlock.getInstance().getDataFolder() + "/" + "structures", "default.structure"));
|
||||
SkyBlock.getInstance().getLogger().log(Level.SEVERE, "Unable to load structure '" + configFile.getAbsolutePath() + "' using default instead.");
|
||||
}
|
||||
|
||||
if (base64 == null) {
|
||||
@ -126,8 +117,7 @@ public final class StructureUtil {
|
||||
Storage storage;
|
||||
|
||||
try {
|
||||
storage = new Gson().fromJson(
|
||||
new String(Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8))), Storage.class);
|
||||
storage = new Gson().fromJson(new String(Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8))), Storage.class);
|
||||
} catch (JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
@ -159,44 +149,30 @@ public final class StructureUtil {
|
||||
for (BlockData blockDataList : blockData) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), () -> {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil
|
||||
.rotateLocation(new org.bukkit.Location(location.getWorld(), blockDataList.getX(),
|
||||
blockDataList.getY(), blockDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(),
|
||||
location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])),
|
||||
location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]),
|
||||
location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), blockDataList.getX(), blockDataList.getY(), blockDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])),
|
||||
location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]), location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
BlockUtil.convertBlockDataToBlock(blockLocation.getBlock(), blockDataList);
|
||||
} catch (Exception e) {
|
||||
SkyBlock.getInstance().getLogger()
|
||||
.warning("Unable to convert BlockData to Block for type {" + blockDataList.getMaterial()
|
||||
+ ":" + blockDataList.getData() + "} in structure {" + structure.getStructureFile()
|
||||
+ "}");
|
||||
.warning("Unable to convert BlockData to Block for type {" + blockDataList.getMaterial() + ":" + blockDataList.getData() + "} in structure {" + structure.getStructureFile() + "}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), () -> {
|
||||
for (EntityData entityDataList : (List<EntityData>) new Gson().fromJson(storage.getEntities(),
|
||||
new TypeToken<List<EntityData>>() {
|
||||
}.getType())) {
|
||||
for (EntityData entityDataList : (List<EntityData>) new Gson().fromJson(storage.getEntities(), new TypeToken<List<EntityData>>() {
|
||||
}.getType())) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), () -> {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil
|
||||
.rotateLocation(new org.bukkit.Location(location.getWorld(), entityDataList.getX(),
|
||||
entityDataList.getY(), entityDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(),
|
||||
location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])),
|
||||
location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]),
|
||||
location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), entityDataList.getX(), entityDataList.getY(), entityDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])),
|
||||
location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]), location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
EntityUtil.convertEntityDataToEntity(entityDataList, blockLocation, type);
|
||||
} catch (Exception e) {
|
||||
SkyBlock.getInstance().getLogger()
|
||||
.warning("Unable to convert EntityData to Entity for type {"
|
||||
+ entityDataList.getEntityType() + "} in structure {"
|
||||
+ structure.getStructureFile() + "}");
|
||||
SkyBlock.getInstance().getLogger().warning("Unable to convert EntityData to Entity for type {" + entityDataList.getEntityType() + "} in structure {" + structure.getStructureFile() + "}");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -213,12 +189,9 @@ public final class StructureUtil {
|
||||
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
ItemStack is = new ItemStack(
|
||||
Material.valueOf(fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getString("Island.Admin.Structure.Selector")));
|
||||
ItemStack is = new ItemStack(Material.valueOf(fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getString("Island.Admin.Structure.Selector")));
|
||||
ItemMeta im = is.getItemMeta();
|
||||
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Island.Structure.Tool.Item.Displayname")));
|
||||
im.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Island.Structure.Tool.Item.Displayname")));
|
||||
|
||||
List<String> itemLore = new ArrayList<>();
|
||||
|
||||
@ -232,8 +205,7 @@ public final class StructureUtil {
|
||||
return is;
|
||||
}
|
||||
|
||||
public static org.bukkit.Location[] getFixedLocations(org.bukkit.Location location1,
|
||||
org.bukkit.Location location2) {
|
||||
public static org.bukkit.Location[] getFixedLocations(org.bukkit.Location location1, org.bukkit.Location location2) {
|
||||
org.bukkit.Location location1Fixed = location1.clone();
|
||||
org.bukkit.Location location2Fixed = location2.clone();
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.songoda.skyblock.utils.version;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum Materials {
|
||||
|
||||
ACACIA_BOAT("BOAT_ACACIA", 0),
|
||||
@ -26,7 +27,7 @@ public enum Materials {
|
||||
ACACIA_SLAB("WOOD_STEP", 4),
|
||||
ACACIA_SIGN("STONE", 0, true),
|
||||
ACACIA_STAIRS("ACACIA_STAIRS", 4),
|
||||
ACACIA_TRAPDOOR("TRAP_DOOR", 0, true),
|
||||
ACACIA_TRAPDOOR("TRAP_DOOR", "OAK_TRAPDOOR", true),
|
||||
ACACIA_WALL_SIGN("STONE", 0, true),
|
||||
ACACIA_WOOD("LOG_2", 0),
|
||||
ACTIVATOR_RAIL("ACTIVATOR_RAIL", 0),
|
||||
@ -70,7 +71,7 @@ public enum Materials {
|
||||
BIRCH_SIGN("STONE", 0, true),
|
||||
BIRCH_SLAB("WOOD_STEP", 2),
|
||||
BIRCH_STAIRS("BIRCH_WOOD_STAIRS", 0),
|
||||
BIRCH_TRAPDOOR("TRAP_DOOR", 0, true),
|
||||
BIRCH_TRAPDOOR("TRAP_DOOR", "OAK_TRAPDOOR", true),
|
||||
BIRCH_WALL_SIGN("STONE", 0, true),
|
||||
BIRCH_WOOD("LOG", 2),
|
||||
BLACK_BANNER("BANNER", 0),
|
||||
@ -248,9 +249,9 @@ public enum Materials {
|
||||
DARK_OAK_PRESSURE_PLATE("WOOD_PLATE", 0, true),
|
||||
DARK_OAK_SAPLING("SAPLING", 5),
|
||||
DARK_OAK_SIGN("STONE", 0, true),
|
||||
DARK_OAK_SLAB("WOOD_STEP", 0),
|
||||
DARK_OAK_SLAB("WOOD_STEP", 5),
|
||||
DARK_OAK_STAIRS("DARK_OAK_STAIRS", 0),
|
||||
DARK_OAK_TRAPDOOR("TRAP_DOOR", 0, true),
|
||||
DARK_OAK_TRAPDOOR("TRAP_DOOR", "OAK_TRAPDOOR", true),
|
||||
DARK_OAK_WALL_SIGN("STONE", 0, true),
|
||||
DARK_OAK_WOOD("LOG_2", 1),
|
||||
DARK_PRISMARINE("PRISMARINE", 2),
|
||||
@ -464,7 +465,7 @@ public enum Materials {
|
||||
JUNGLE_SIGN("STONE", 0, true),
|
||||
JUNGLE_SLAB("WOOD_STEP", 3),
|
||||
JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS", 0),
|
||||
JUNGLE_TRAPDOOR("TRAP_DOOR", 0, true),
|
||||
JUNGLE_TRAPDOOR("TRAP_DOOR", "OAK_TRAPDOOR", true),
|
||||
JUNGLE_WALL_SIGN("STONE", 0, true),
|
||||
JUNGLE_WOOD("LOG", 3),
|
||||
KELP("STONE", 0, true),
|
||||
@ -932,7 +933,7 @@ public enum Materials {
|
||||
SPRUCE_SIGN("STONE", 0, true),
|
||||
SPRUCE_SLAB("WOOD_STEP", 1),
|
||||
SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS", 0),
|
||||
SPRUCE_TRAPDOOR("TRAP_DOOR", 0, true),
|
||||
SPRUCE_TRAPDOOR("TRAP_DOOR", 1, true),
|
||||
SPRUCE_WALL_SIGN("STONE", 0, true),
|
||||
SPRUCE_WOOD("LOG", 1),
|
||||
SQUID_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
@ -1056,22 +1057,30 @@ public enum Materials {
|
||||
ZOMBIE_PIGMAN_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
ZOMBIE_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
ZOMBIE_WALL_HEAD("SKULL", 0);
|
||||
|
||||
ZOMBIE_WALL_HEAD("SKULL", 0),
|
||||
HONEYCOMB("STONE", 0, true),
|
||||
HONEYCOMB_BLOCK("STONE", 0, true),
|
||||
BEE_NEST("STONE", 0, true),
|
||||
BEEHIVE("STONE", 0, true),
|
||||
HONEY_BLOCK("stone", 0, true),
|
||||
HONEY_BOTTLE("stone", 0, true),
|
||||
BEE_SPAWN_EGG("stone", 0, true);
|
||||
|
||||
private static final Set<Materials> ALL = Collections.unmodifiableSet(EnumSet.allOf(Materials.class));
|
||||
|
||||
public static Set<Materials> getAllMaterials(){
|
||||
public static Set<Materials> getAllMaterials() {
|
||||
return ALL;
|
||||
}
|
||||
|
||||
|
||||
static int newV = -1;
|
||||
private static HashMap<String, Materials> cachedSearch = new HashMap<>();
|
||||
private static Map<String, Materials> cachedSearch = new HashMap<>();
|
||||
String old13Mat;
|
||||
String old12Mat;
|
||||
int data;
|
||||
boolean is13Plusonly;
|
||||
private Material cachedMaterial;
|
||||
private boolean isMaterialParsed = false;
|
||||
private String actualMaterials;
|
||||
|
||||
Materials(String old13Mat, String old12Mat, int data) {
|
||||
this(old13Mat, old12Mat, data, false);
|
||||
@ -1092,6 +1101,15 @@ public enum Materials {
|
||||
this(null, old12Mat, data, is13Plusonly);
|
||||
}
|
||||
|
||||
Materials(String old12Mat, String actualMaterials, boolean is13Plusonly) {
|
||||
this(old12Mat, 0, is13Plusonly);
|
||||
this.actualMaterials = actualMaterials;
|
||||
}
|
||||
|
||||
public Materials getActualMaterials() {
|
||||
return actualMaterials == null ? null : Materials.valueOf(actualMaterials);
|
||||
}
|
||||
|
||||
public static boolean isNewVersion() {
|
||||
if (newV == 0) return false;
|
||||
if (newV == 1) return true;
|
||||
@ -1128,22 +1146,24 @@ public enum Materials {
|
||||
// Try 1.13+ names
|
||||
for (Materials mat : ALL) {
|
||||
if (name.equalsIgnoreCase(mat.name())) {
|
||||
if (pmat == null)
|
||||
pmat = mat;
|
||||
if (pmat == null) pmat = mat;
|
||||
|
||||
if (((byte) mat.data) == data)
|
||||
return mat;
|
||||
final Materials actual = mat.getActualMaterials();
|
||||
|
||||
if (actual != null && mat.is13Plusonly) return actual;
|
||||
if (((byte) mat.data) == data) return mat;
|
||||
}
|
||||
}
|
||||
|
||||
// Try 1.12- names
|
||||
for (Materials mat : ALL) {
|
||||
if (name.equalsIgnoreCase(mat.old12Mat)) {
|
||||
if (pmat == null)
|
||||
pmat = mat;
|
||||
if (pmat == null) pmat = mat;
|
||||
|
||||
if (((byte) mat.data) == data)
|
||||
return mat;
|
||||
final Materials actual = mat.getActualMaterials();
|
||||
|
||||
if (actual != null && mat.is13Plusonly) return actual;
|
||||
if (((byte) mat.data) == data) return mat;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1197,8 +1217,7 @@ public enum Materials {
|
||||
if (this.isSpawner() && this != Materials.SPAWNER) {
|
||||
String spawnerType = this.name().replace("SPAWNER_", "");
|
||||
for (EntityType entityType : EntityType.values())
|
||||
if (entityType.name().equalsIgnoreCase(spawnerType))
|
||||
return true;
|
||||
if (entityType.name().equalsIgnoreCase(spawnerType)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1241,29 +1260,28 @@ public enum Materials {
|
||||
String[] split = type.toString().split("_");
|
||||
int length = split.length;
|
||||
switch (split[length - 1]) {
|
||||
case "HELMET":
|
||||
case "SHEARS":
|
||||
case "HORSE_ARMOR":
|
||||
case "TRIDENT":
|
||||
case "TURTLE_HELMET":
|
||||
case "ELYTRA":
|
||||
case "HOE":
|
||||
case "SHOVEL":
|
||||
case "PICKAXE":
|
||||
case "AXE":
|
||||
case "SWORD":
|
||||
case "BOOTS":
|
||||
case "LEGGINGS":
|
||||
case "CHESTPLATE":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case "HELMET":
|
||||
case "SHEARS":
|
||||
case "HORSE_ARMOR":
|
||||
case "TRIDENT":
|
||||
case "TURTLE_HELMET":
|
||||
case "ELYTRA":
|
||||
case "HOE":
|
||||
case "SHOVEL":
|
||||
case "PICKAXE":
|
||||
case "AXE":
|
||||
case "SWORD":
|
||||
case "BOOTS":
|
||||
case "LEGGINGS":
|
||||
case "CHESTPLATE":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Material parseMaterial() {
|
||||
if (this.cachedMaterial != null || this.isMaterialParsed)
|
||||
return this.cachedMaterial;
|
||||
if (this.cachedMaterial != null || this.isMaterialParsed) return this.cachedMaterial;
|
||||
|
||||
if (this.isSpawner() && this != Materials.SPAWNER) {
|
||||
this.cachedMaterial = Materials.SPAWNER.parseMaterial();
|
||||
|
@ -1,3 +1,12 @@
|
||||
ClassLocalization:
|
||||
Materials:
|
||||
LEGACY_DOUBLE_PLANT: 'Sunflower'
|
||||
IslandRoles:
|
||||
Coop: 'Coop'
|
||||
Visitor: 'Visitor'
|
||||
Member: 'Member'
|
||||
Operator: 'Operator'
|
||||
Owner: 'Owner'
|
||||
Command:
|
||||
Island:
|
||||
Bans:
|
||||
|
Loading…
Reference in New Issue
Block a user