9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-28 03:19:15 +00:00

Fixed remove items not working

This commit is contained in:
MasterOfTheFish
2022-02-19 20:10:38 -05:00
parent 6ccc40798a
commit be7092b422
4 changed files with 36 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ public class WardrobeSettings {
private static final String DESPAWN_DELAY_PATH = WARDROBE_PATH + ".despawn-delay";
private static final String STATIC_LOCATION_PATH = WARDROBE_PATH + ".wardrobe-location";
private static final String VIEWER_LOCATION_PATH = WARDROBE_PATH + ".viewer-location";
private static final String LEAVE_LOCATION_PATH = WARDROBE_PATH + ".leave-location";
private static final String WORLD_PATH = "world";
private static final String X_PATH = "x";
private static final String Y_PATH = "y";
@@ -43,6 +44,7 @@ public class WardrobeSettings {
private int despawnDelay;
private Location wardrobeLocation;
private Location viewerLocation;
private Location leaveLocation;
public WardrobeSettings(final HMCCosmetics plugin) {
this.plugin = plugin;
@@ -66,6 +68,13 @@ public class WardrobeSettings {
final ConfigurationSection viewerLocationSection = config.getConfigurationSection(VIEWER_LOCATION_PATH);
if (viewerLocationSection == null) return;
this.viewerLocation = this.loadLocation(viewerLocationSection);
final ConfigurationSection leaveLocationSection = config.getConfigurationSection(LEAVE_LOCATION_PATH);
if (leaveLocationSection == null) {
this.leaveLocation = this.viewerLocation;
return;
}
this.leaveLocation = this.loadLocation(leaveLocationSection);
}
@Nullable
@@ -123,6 +132,10 @@ public class WardrobeSettings {
return viewerLocation;
}
public Location getLeaveLocation() {
return leaveLocation;
}
public boolean inDistanceOfWardrobe(final Location wardrobeLocation, final Location playerLocation) {
if (this.displayRadius == -1) return true;
if (!wardrobeLocation.getWorld().equals(playerLocation.getWorld())) return false;

View File

@@ -146,6 +146,7 @@ public class Wardrobe extends User {
this.cameraLocked = false;
this.currentLocation = null;
this.getPlayerArmor().clear();
Bukkit.getScheduler().runTask(this.plugin, () -> viewer.teleport(settings.getLeaveLocation()));
if (settings.isAlwaysDisplay()) {
this.currentLocation = settings.getWardrobeLocation();

View File

@@ -26,10 +26,10 @@ wardrobe:
static-radius: 10
# how much yaw should change per tick, set to 0 for none
rotation-speed: 3
# how long in seconds until the wardrobe should be spawned
spawn-delay: 0
# how long in seconds until the wardrobe should be despawned
despawn-delay: 0
# how long in ticks until the wardrobe should be spawned
spawn-delay: 40
# how long in ticks until the wardrobe should be despawned
despawn-delay: 40
# location of static wardrobe, remove for none
wardrobe-location:
world: "World"
@@ -44,4 +44,11 @@ wardrobe:
y: 0
z: 5
yaw: 0
pitch: 0
leave-location:
world: "World"
x: 5
y: 5
z: 5
yaw: 0
pitch: 0