mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 14:44:43 +02:00
Compare commits
2 Commits
feat/plotB
...
fix/plotMu
Author | SHA1 | Date | |
---|---|---|---|
f94f7acb59 | |||
a1d94af242 |
@ -40,6 +40,7 @@ import io.papermc.lib.PaperLib;
|
|||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.WeatherType;
|
import org.bukkit.WeatherType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -51,7 +52,6 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import org.checkerframework.checker.index.qual.NonNegative;
|
import org.checkerframework.checker.index.qual.NonNegative;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -309,18 +309,21 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
@Override
|
@Override
|
||||||
public void playMusic(final @NonNull Location location, final @NonNull ItemType id) {
|
public void playMusic(final @NonNull Location location, final @NonNull ItemType id) {
|
||||||
if (id == ItemTypes.AIR) {
|
if (id == ItemTypes.AIR) {
|
||||||
// Let's just stop all the discs because why not?
|
if (PlotSquared.platform().serverVersion()[1] >= 19) {
|
||||||
for (final Sound sound : Arrays.stream(Sound.values())
|
player.stopSound(SoundCategory.MUSIC);
|
||||||
.filter(sound -> sound.name().contains("DISC")).toList()) {
|
return;
|
||||||
player.stopSound(sound);
|
|
||||||
}
|
}
|
||||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
|
// 1.18 and downwards require a specific Sound to stop (even tho the packet does not??)
|
||||||
} else {
|
for (final Sound sound : Sound.values()) {
|
||||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id.to(Material.class));
|
if (sound.name().startsWith("MUSIC_DISC")) {
|
||||||
this.player.playSound(BukkitUtil.adapt(location),
|
this.player.stopSound(sound, SoundCategory.MUSIC);
|
||||||
Sound.valueOf(BukkitAdapter.adapt(id).name()), Float.MAX_VALUE, 1f
|
}
|
||||||
);
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
this.player.playSound(BukkitUtil.adapt(location), Sound.valueOf(BukkitAdapter.adapt(id).name()),
|
||||||
|
SoundCategory.MUSIC, 1f, 1f
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
||||||
|
@ -2401,7 +2401,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
addPlotTask(plot, new UniqueStatement("setPosition") {
|
addPlotTask(plot, new UniqueStatement("setPosition") {
|
||||||
@Override
|
@Override
|
||||||
public void set(PreparedStatement statement) throws SQLException {
|
public void set(PreparedStatement statement) throws SQLException {
|
||||||
statement.setString(1, position == null ? "" : position);
|
// Please see the table creation statement. There is the default value of "default"
|
||||||
|
statement.setString(1, position == null ? "DEFAULT" : position);
|
||||||
statement.setInt(2, getId(plot));
|
statement.setInt(2, getId(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public void setHome(BlockLoc location) {
|
public void setHome(BlockLoc location) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
|
if (location != null && (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.getSettings().setPosition(location);
|
plot.getSettings().setPosition(location);
|
||||||
|
Reference in New Issue
Block a user