Просмотр исходного кода

reworked some gradle parts.
Added quick Spigot plugin hackery for extending item despawn timer for death drops (requires java11 or higher as Gradle environment to build fully, gets skipped if not to avoid build fail on build-all)

LH 5 лет назад
Родитель
Сommit
099c494a17

+ 6 - 0
build.gradle

@@ -17,10 +17,16 @@ allprojects {
 		//	url "http://4thline.org/m2"
 		//}
 		
+        maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"}
+        
 		maven { url "http://repo.gradle.org/gradle/libs-releases-local" }
 		
 		maven {
 			url "https://dl.bintray.com/ijabz/maven"
 		}
+        
+        maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
+        
+        mavenLocal();
 	}
 }

+ 27 - 26
external/java-progressbar/build.gradle

@@ -1,26 +1,27 @@
-apply plugin: 'java'
-
-compileJava.options.encoding = 'UTF-8'
-
-repositories {
-	mavenCentral()
-}
-
-dependencies {
-	compile group: 'com.google.guava', name: 'guava', version: '19.0'
-	testCompile group: 'org.testng', name: 'testng', version: '6.9.10'
-}
-
-test {
-	useTestNG() {
-		suites 'testng.xml' 
-	}
-}
-
-uploadArchives {
-	repositories {
-		flatDir {
-			dirs 'repos'
-		}
-	}
-}
+apply plugin: 'java'
+
+compileJava.options.encoding = 'UTF-8'
+
+sourceCompatibility = 1.8
+repositories {
+	mavenCentral()
+}
+
+dependencies {
+	compile group: 'com.google.guava', name: 'guava', version: '19.0'
+	testCompile group: 'org.testng', name: 'testng', version: '6.9.10'
+}
+
+test {
+	useTestNG() {
+		suites 'testng.xml' 
+	}
+}
+
+uploadArchives {
+	repositories {
+		flatDir {
+			dirs 'repos'
+		}
+	}
+}

BIN
gradle/wrapper/gradle-wrapper.jar


+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists

+ 31 - 20
gradlew

@@ -1,5 +1,21 @@
 #!/usr/bin/env sh
 
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 ##############################################################################
 ##
 ##  Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
@@ -109,8 +125,8 @@ 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
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
     JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,19 +154,19 @@ if $cygwin ; then
         else
             eval `echo args$i`="\"$arg\""
         fi
-        i=$((i+1))
+        i=`expr $i + 1`
     done
     case $i in
-        (0) set -- ;;
-        (1) set -- "$args0" ;;
-        (2) set -- "$args0" "$args1" ;;
-        (3) set -- "$args0" "$args1" "$args2" ;;
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+        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
 
@@ -159,14 +175,9 @@ save () {
     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
     echo " "
 }
-APP_ARGS=$(save "$@")
+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" "$@"

+ 20 - 1
gradlew.bat

@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
 @if "%DEBUG%" == "" @echo off
 @rem ##########################################################################
 @rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
 set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
 
 @rem Find java.exe
 if defined JAVA_HOME goto findJavaFromJavaHome

+ 1 - 1
settings.gradle

@@ -1,4 +1,4 @@
 include 'ToolKit','iZpl',  'IZSetup','WPCMGr','UpidTK', 'izstreamer', 'LogBlockHeatMapper','iZlaunch',
 'iZpaqSFX','MazeViewer','TWPUtil',"iZplPlugins:WMP","iZplPlugins:foobar2000_others","iZplPlugins:itunes","iZplPlugins:GameRadio",
 "iZplPlugins:Editor","izpl-shared","iZpl-server","iZplPlugins:Smartphonizer","QuickStuff","external:java-progressbar","iZplPlugins:rtsslink","iZplPlugins:JukeBox",
-"iZplPlugins:Extractor"
+"iZplPlugins:Extractor","spungit_deathtimer"

+ 29 - 0
spungit_deathtimer/build.gradle

@@ -0,0 +1,29 @@
+    plugins {
+       id 'kr.entree.spigradle' version '1.2.1' apply false
+    }
+
+apply plugin: 'java'
+if(org.gradle.api.JavaVersion.current().isJava11Compatible())
+{
+    apply plugin: 'kr.entree.spigradle'
+}
+else
+{
+   logger.warn('Full Build requires Java 11 or highher.')
+}
+group 'de.nplusc.izc'
+version '1.0-SNAPSHOT'
+
+sourceCompatibility = 1.8
+
+dependencies {
+  compileOnly 'org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
+}
+if(org.gradle.api.JavaVersion.current().isJava11Compatible())
+{
+    spigot {
+       authors = ['iZc']
+       apiVersion = '1.15'
+       load = STARTUP
+    }
+}

+ 80 - 0
spungit_deathtimer/src/main/java/de/nplusc/izc/spungit/DeathItemTimerExtender.java

@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2020 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.spungit;
+
+import net.minecraft.server.v1_15_R1.EntityItem;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.v1_15_R1.entity.CraftItem;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Item;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDropItemEvent;
+import org.bukkit.event.entity.ItemSpawnEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.persistence.PersistentDataType;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.util.ListIterator;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class DeathItemTimerExtender extends JavaPlugin implements Listener
+{
+    private final NamespacedKey key = new NamespacedKey(this, "deathitemflag");
+    @Override
+    public void onEnable()
+    {
+        getLogger().info("QnD Hack for death countdown extender loaded");
+        getServer().getPluginManager().registerEvents(this, this);
+    }
+
+    @EventHandler
+    public void onPlayerDeath(PlayerDeathEvent e) {
+        ListIterator<ItemStack> iter = e.getDrops().listIterator();
+        while(iter.hasNext())
+        {
+            ItemStack i = iter.next();
+            ItemMeta im = i.getItemMeta();
+                    im.getPersistentDataContainer().set(key, PersistentDataType.BYTE,(byte)1);
+                    i.setItemMeta(im);
+        }
+    }
+
+    @EventHandler public void onItemSpawn(ItemSpawnEvent e)
+    {
+        ItemMeta im = e.getEntity()
+                .getItemStack()
+                .getItemMeta();
+        byte flag = im
+                .getPersistentDataContainer()
+                .getOrDefault(key,PersistentDataType.BYTE,(byte)0);
+        if(flag>0)
+        {
+            im.getPersistentDataContainer().remove(key);
+            //zapping the tag after it did its magic
+            e.getEntity().getItemStack().setItemMeta(im);
+            Item ent = e.getEntity();
+            getLogger().info("Item entity to rig detected");
+            ((EntityItem)((CraftItem)ent).getHandle()).age = -1*(20*60*25);
+        }
+    }
+}