mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Recommend paper just like FAWE. I want to be like the cool kids.
Oh, and fix an issue with `/plot music`. Still broken. Just not the same kind of broken.
This commit is contained in:
parent
f1378013c1
commit
b05316c000
@ -158,6 +158,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer);
|
||||
|
||||
if (Bukkit.getVersion().contains("git-Spigot")) {
|
||||
// Uses System.out.println because the logger isn't initialized yet
|
||||
System.out.println("[P2] ====== USE PAPER ======");
|
||||
System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads");
|
||||
System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/");
|
||||
System.out.println("[P2] - This is only a recommendation");
|
||||
System.out.println("[P2] ==============================");
|
||||
}
|
||||
|
||||
new PlotSquared(this, "Bukkit");
|
||||
if (Settings.Enabled_Components.METRICS) {
|
||||
this.startMetrics();
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Piston;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -1516,6 +1517,7 @@ import java.util.regex.Pattern;
|
||||
PlotInventory inventory = pp.getMeta("inventory");
|
||||
if (inventory != null && event.getRawSlot() == event.getSlot()) {
|
||||
if (!inventory.onClick(event.getSlot())) {
|
||||
event.setResult(Event.Result.DENY);
|
||||
event.setCancelled(true);
|
||||
inventory.close();
|
||||
}
|
||||
|
@ -314,7 +314,11 @@ import java.util.zip.ZipInputStream;
|
||||
if (message == null || message.toString().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PlotSquared.get().getLogger().log(StringMan.getString(message));
|
||||
if (PlotSquared.get() == null || PlotSquared.get().getLogger() == null) {
|
||||
System.out.printf("[P2][Info] %s\n", StringMan.getString(message));
|
||||
} else {
|
||||
PlotSquared.get().getLogger().log(StringMan.getString(message));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,7 +329,11 @@ import java.util.zip.ZipInputStream;
|
||||
*/
|
||||
public static void debug(@Nullable Object message) {
|
||||
if (Settings.DEBUG) {
|
||||
PlotSquared.log(message);
|
||||
if (PlotSquared.get() == null || PlotSquared.get().getLogger() == null) {
|
||||
System.out.printf("[P2][Debug] %s\n", StringMan.getString(message));
|
||||
} else {
|
||||
PlotSquared.get().getLogger().log(StringMan.getString(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,20 +128,20 @@ public class PlotListener {
|
||||
|
||||
Optional<Integer> musicFlag = plot.getFlag(Flags.MUSIC);
|
||||
if (musicFlag.isPresent()) {
|
||||
Integer id = musicFlag.get();
|
||||
if ((id >= 2256 && id <= 2267) || (id == 0)) {
|
||||
Number id = musicFlag.get();
|
||||
if ((id.intValue() >= 2256 && id.intValue() <= 2267) || (id.intValue() == 0)) {
|
||||
Location loc = player.getLocation();
|
||||
Location lastLoc = player.getMeta("music");
|
||||
if (lastLoc != null) {
|
||||
player.playMusic(lastLoc, 0);
|
||||
if (id == 0) {
|
||||
if (id.intValue() == 0) {
|
||||
player.deleteMeta("music");
|
||||
}
|
||||
}
|
||||
if (id != 0) {
|
||||
if (id.intValue() != 0) {
|
||||
try {
|
||||
player.setMeta("music", loc);
|
||||
player.playMusic(loc, id);
|
||||
player.playMusic(loc, id.intValue());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
@ -45,19 +45,19 @@ public class StringMan {
|
||||
return (String) obj;
|
||||
}
|
||||
if (obj.getClass().isArray()) {
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
String prefix = "";
|
||||
|
||||
for (int i = 0; i < Array.getLength(obj); i++) {
|
||||
result += prefix + getString(Array.get(obj, i));
|
||||
result.append(prefix).append(getString(Array.get(obj, i)));
|
||||
prefix = ",";
|
||||
}
|
||||
return "( " + result + " )";
|
||||
} else if (obj instanceof Collection<?>) {
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
String prefix = "";
|
||||
for (Object element : (Collection<?>) obj) {
|
||||
result += prefix + getString(element);
|
||||
result.append(prefix).append(getString(element));
|
||||
prefix = ",";
|
||||
}
|
||||
return "[ " + result + " ]";
|
||||
|
Loading…
Reference in New Issue
Block a user