Compare commits

..

No commits in common. "master" and "plot_rtp" have entirely different histories.

12 changed files with 25 additions and 141 deletions

8
Jenkinsfile vendored
View File

@ -3,13 +3,7 @@ pipeline {
stages {
stage('Gradle') {
steps {
withCredentials([usernamePassword(credentialsId: 'alttd-snapshot-user', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh '''
set +x
chmod +x gradlew
./gradlew build -PalttdSnapshotUsername=$USERNAME -PalttdSnapshotPassword=$PASSWORD
'''
}
sh 'bash gradlew build'
}
}
stage('Archive') {

View File

@ -10,6 +10,12 @@ description = "Altitude's Transfer Items plugin"
apply<JavaLibraryPlugin>()
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks {
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
@ -33,7 +39,9 @@ tasks {
}
dependencies {
compileOnly("com.alttd.cosmos:cosmos-api:26.2.build.17-stable")
compileOnly("com.alttd.cosmos:cosmos-api:1.21.10-R0.1-SNAPSHOT") {
isChanging = true
}
implementation("org.slf4j:slf4j-api:2.0.17")

Binary file not shown.

View File

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

19
gradlew vendored
View File

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# 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"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

1
gradlew.bat vendored
View File

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

View File

@ -14,13 +14,6 @@ dependencyResolutionManagement {
password = nexusPass
}
}
maven {
url = uri("https://repo.alttd.com/repository/alttd/")
credentials {
username = nexusUser
password = nexusPass
}
}
maven("https://jitpack.io")
// PlotSquared
maven("https://repo.papermc.io/repository/maven-public/")

View File

@ -57,7 +57,6 @@ public final class PlayerUtils extends JavaPlugin {
pluginManager.registerEvents(new PlayerJoin(this), this);
pluginManager.registerEvents(new BookWriteEvent(), this);
pluginManager.registerEvents(new BookByteLimitListener(), this);
pluginManager.registerEvents(new VillagerWorkstationEvent(this), this);
RotateBlockEvent rotateBlockEvent = new RotateBlockEvent();
pluginManager.registerEvents(rotateBlockEvent, this);

View File

@ -95,21 +95,6 @@ public class Config extends AbstractConfig {
}
}
public static class VILLAGER_WORKSTATION {
private static final String prefix = "villager-workstation.";
public static int RANGE = 8;
public static int CHECK_INTERVAL_TICKS = 5;
public static int PARTICLE_RING_COUNT = 8;
@SuppressWarnings("unused")
private static void load() {
RANGE = config.getInt(prefix, "range", RANGE);
CHECK_INTERVAL_TICKS = config.getInt(prefix, "check-interval-ticks", CHECK_INTERVAL_TICKS);
PARTICLE_RING_COUNT = config.getInt(prefix, "particle-ring-count", PARTICLE_RING_COUNT);
}
}
public static class RANDOM_PLOT {
private static final String prefix = "random-plot.";

View File

@ -197,20 +197,6 @@ public class Messages extends AbstractConfig {
}
}
public static class VILLAGER_WORKSTATION {
private static final String prefix = "villager-workstation.";
public static String WORKSTATION = "<gold>Villager (<profession>): <yellow><workstation></yellow></gold>";
public static String NO_WORKSTATION = "<gold>Villager (<profession>): <gray>No workstation</gray></gold>";
@SuppressWarnings("unused")
private static void load() {
WORKSTATION = config.getString(prefix, "workstation", WORKSTATION);
NO_WORKSTATION = config.getString(prefix, "no-workstation", NO_WORKSTATION);
}
}
public static class RANDOM_PLOT {
private static final String prefix = "random-plot.";

View File

@ -1,84 +0,0 @@
package com.alttd.playerutils.event_listeners;
import com.alttd.playerutils.config.Config;
import com.alttd.playerutils.config.Messages;
import lombok.extern.slf4j.Slf4j;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.entity.memory.MemoryKey;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
@Slf4j
public class VillagerWorkstationEvent implements Listener {
public VillagerWorkstationEvent(JavaPlugin plugin) {
Bukkit.getScheduler().runTaskTimer(plugin, this::checkPlayersLookingAtVillagers,
0L, Config.VILLAGER_WORKSTATION.CHECK_INTERVAL_TICKS);
}
private void checkPlayersLookingAtVillagers() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.getInventory().getItemInMainHand().getType().equals(Material.AIR)) {
continue;
}
Entity target = player.getTargetEntity(Config.VILLAGER_WORKSTATION.RANGE);
if (!(target instanceof Villager villager)) {
continue;
}
showWorkstation(player, villager);
}
}
private void showWorkstation(Player player, Villager villager) {
String professionName = formatName(villager.getProfession().key().asMinimalString());
Location jobSite = villager.getMemory(MemoryKey.JOB_SITE);
if (jobSite == null) {
player.sendActionBar(MiniMessage.miniMessage().deserialize(
Messages.VILLAGER_WORKSTATION.NO_WORKSTATION
.replace("<profession>", professionName)));
return;
}
// Read the actual block type at the linked location so it reflects reality
String blockName = formatName(jobSite.getBlock().getType().name());
player.sendActionBar(MiniMessage.miniMessage().deserialize(
Messages.VILLAGER_WORKSTATION.WORKSTATION
.replace("<profession>", professionName)
.replace("<workstation>", blockName)));
spawnWorkstationParticles(player, jobSite.getBlock().getLocation());
}
private void spawnWorkstationParticles(Player player, Location blockLoc) {
World world = blockLoc.getWorld();
if (world == null) {
return;
}
double cx = blockLoc.getX() + 0.5;
double cy = blockLoc.getY() + 1.1;
double cz = blockLoc.getZ() + 0.5;
int count = Config.VILLAGER_WORKSTATION.PARTICLE_RING_COUNT;
for (int i = 0; i < count; i++) {
double angle = (2 * Math.PI * i) / count;
double x = cx + 0.5 * Math.cos(angle);
double z = cz + 0.5 * Math.sin(angle);
player.spawnParticle(Particle.HAPPY_VILLAGER, x, cy, z, 1, 0, 0, 0, 0);
}
}
private static String formatName(String enumName) {
String lower = enumName.replace("_", " ").toLowerCase();
return Character.toUpperCase(lower.charAt(0)) + lower.substring(1);
}
}

View File

@ -2,10 +2,6 @@ name: PlayerUtils
version: '${version}'
main: com.alttd.playerutils.PlayerUtils
api-version: '1.20'
softdepend:
- PlotSquared
- LuckPerms
- Vault
commands:
playerutils:
description: Base command for player utils