Skip to content

Commit

Permalink
Merge pull request #152 from Nookure/dev
Browse files Browse the repository at this point in the history
release
  • Loading branch information
Angelillo15 authored Jan 10, 2025
2 parents 408baec + 1857de7 commit f149a6d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void disableStaffMode() {
long time = System.currentTimeMillis();
player.disablePlayerPerks();
restoreInventory();
if (config.get().staffMode.teleportToPreviousLocation()) restoreInventory();
if (config.get().staffMode.teleportToPreviousLocation()) restoreLocation();
player.sendMiniMessage(messages.get().staffMode.toggledOff());
writeStaffModeState(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import com.nookure.staff.paper.extension.FreezePlayerExtension;
import com.nookure.staff.paper.factory.PaperPlayerWrapperFactory;
import com.nookure.staff.paper.factory.StaffPaperPlayerWrapperFactory;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.util.List;
Expand All @@ -31,6 +33,7 @@ public final class PaperPlayerTransformer implements PlayerTransformer {
private final ConfigurationContainer<BukkitMessages> messages;
private final FreezeManager freezeManager;
private final List<Class<? extends PlayerState>> states;
private JavaPlugin plugin;

@Inject
public PaperPlayerTransformer(
Expand All @@ -40,7 +43,8 @@ public PaperPlayerTransformer(
@NotNull final Logger logger,
@NotNull final ConfigurationContainer<BukkitMessages> messages,
@NotNull final FreezeManager freezeManager,
@NotNull final List<Class<? extends PlayerState>> states
@NotNull final List<Class<? extends PlayerState>> states,
@NotNull final JavaPlugin plugin
) {
this.playerWrapperManager = playerWrapperManager;
this.paperPlayerWrapperFactory = paperPlayerWrapperFactory;
Expand All @@ -49,6 +53,7 @@ public PaperPlayerTransformer(
this.logger = logger;
this.messages = messages;
this.states = states;
this.plugin = plugin;
}

@Override
Expand All @@ -58,16 +63,20 @@ public void player2Staff(@NotNull final UUID uuid) {

if (player instanceof StaffPlayerWrapper) {
logger.debug("Player %s is already a staff member.", player.getName());
return;
}

if (!(player instanceof PaperPlayerWrapper paperPlayerWrapper)) return;

playerWrapperManager.removePlayerWrapper(paperPlayerWrapper.getPlayer());
final StaffPaperPlayerWrapper staffPlayerWrapper = staffPaperPlayerWrapperFactory
.create(paperPlayerWrapper.getPlayer(), states);

playerWrapperManager.addPlayerWrapper(staffPlayerWrapper.getPlayer(), staffPlayerWrapper);
staffPlayerWrapper.sendMiniMessage(messages.get().youAreNowAnStaffDuringPermissionInterceptor());
Bukkit.getScheduler().runTask(plugin, () -> {
final StaffPaperPlayerWrapper staffPlayerWrapper = staffPaperPlayerWrapperFactory
.create(paperPlayerWrapper.getPlayer(), states);

playerWrapperManager.addPlayerWrapper(staffPlayerWrapper.getPlayer(), staffPlayerWrapper);
staffPlayerWrapper.sendMiniMessage(messages.get().youAreNowAnStaffDuringPermissionInterceptor());
});
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ allprojects {
repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://maven.nookure.com")
maven("https://mvn.exceptionflug.de/repository/exceptionflug-public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down

0 comments on commit f149a6d

Please sign in to comment.