mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
More work
This commit is contained in:
parent
7f29b5d1e8
commit
c31c4b4286
@ -65,7 +65,6 @@ import com.plotsquared.core.PlotSquared;
|
|||||||
import com.plotsquared.core.backup.BackupManager;
|
import com.plotsquared.core.backup.BackupManager;
|
||||||
import com.plotsquared.core.command.WE_Anywhere;
|
import com.plotsquared.core.command.WE_Anywhere;
|
||||||
import com.plotsquared.core.components.ComponentPresetManager;
|
import com.plotsquared.core.components.ComponentPresetManager;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
|
||||||
import com.plotsquared.core.configuration.caption.ChatFormatter;
|
import com.plotsquared.core.configuration.caption.ChatFormatter;
|
||||||
import com.plotsquared.core.configuration.ConfigurationNode;
|
import com.plotsquared.core.configuration.ConfigurationNode;
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
@ -276,7 +275,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
|||||||
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
||||||
// Perform upgrade
|
// Perform upgrade
|
||||||
if (DBFunc.dbManager.convertFlags()) {
|
if (DBFunc.dbManager.convertFlags()) {
|
||||||
log(Captions.PREFIX.getTranslated() + "Flags were converted successfully!");
|
logger.info("[P2] Flags were converted successfully!");
|
||||||
// Update the config version
|
// Update the config version
|
||||||
try {
|
try {
|
||||||
plotSquared.setConfigurationVersion("v5");
|
plotSquared.setConfigurationVersion("v5");
|
||||||
|
@ -36,14 +36,15 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.core.command.Command;
|
import com.plotsquared.core.command.Command;
|
||||||
import com.plotsquared.core.command.MainCommand;
|
import com.plotsquared.core.command.MainCommand;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
@ -287,7 +288,10 @@ public class PaperListener implements Listener {
|
|||||||
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
||||||
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||||
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
||||||
Captions.TILE_ENTITY_CAP_REACHED.send(plotPlayer, Settings.Chunk_Processor.MAX_TILES);
|
plotPlayer.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
||||||
|
Template.of("<amount>", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||||
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setBuild(false);
|
event.setBuild(false);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import com.plotsquared.bukkit.player.BukkitPlayer;
|
|||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.UpdateUtility;
|
import com.plotsquared.bukkit.util.UpdateUtility;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.caption.Caption;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
@ -706,19 +707,17 @@ import java.util.regex.Pattern;
|
|||||||
this.eventDispatcher.doJoinTask(pp);
|
this.eventDispatcher.doJoinTask(pp);
|
||||||
}, TaskTime.seconds(1L));
|
}, TaskTime.seconds(1L));
|
||||||
|
|
||||||
if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated())
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString())
|
||||||
&& Settings.Enabled_Components.UPDATE_NOTIFICATIONS && PremiumVerification.isPremium()
|
&& Settings.Enabled_Components.UPDATE_NOTIFICATIONS
|
||||||
|
&& PremiumVerification.isPremium()
|
||||||
&& UpdateUtility.hasUpdate) {
|
&& UpdateUtility.hasUpdate) {
|
||||||
new PlotMessage("-----------------------------------").send(pp);
|
Caption upperBoundary = TranslatableCaption.of("update.update_boundary");
|
||||||
new PlotMessage(Captions.PREFIX + "There appears to be a PlotSquared update available!")
|
Caption updateNotification = TranslatableCaption.of("update.update_notification");
|
||||||
.color("$1").send(pp);
|
Template internalVersion = Template.of("p2version", String.valueOf(UpdateUtility.internalVersion.versionString()));
|
||||||
new PlotMessage(
|
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
|
||||||
Captions.PREFIX + "&6You are running version " + UpdateUtility.internalVersion
|
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
|
||||||
.versionString() + ", &6latest version is " + UpdateUtility.spigotVersion)
|
Caption lowerBoundary = TranslatableCaption.of("update.update_boundary");
|
||||||
.color("$1").send(pp);
|
pp.sendMessage(upperBoundary, updateNotification, internalVersion, spigotVersion, downloadUrl, lowerBoundary);
|
||||||
new PlotMessage(Captions.PREFIX + "Download at:").color("$1").send(pp);
|
|
||||||
player.sendMessage(" https://www.spigotmc.org/resources/77506/updates");
|
|
||||||
new PlotMessage("-----------------------------------").send(pp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,10 +1024,11 @@ import java.util.regex.Pattern;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
String message = event.getMessage();
|
Caption msg = TranslatableCaption.of("chat.plot_chat_format");
|
||||||
String format = Captions.PLOT_CHAT_FORMAT.getTranslated();
|
Template msgTemplate = Template.of("msg", event.getMessage());
|
||||||
String sender = event.getPlayer().getDisplayName();
|
Template plotTemplate = Template.of("plot_id", String.valueOf(plot.getId()));
|
||||||
PlotId id = plot.getId();
|
Template senderTemplate = Template.of("sender", event.getPlayer().getDisplayName());
|
||||||
|
plotPlayer.sendMessage(msg, msgTemplate, plotTemplate, senderTemplate);
|
||||||
Set<Player> recipients = event.getRecipients();
|
Set<Player> recipients = event.getRecipients();
|
||||||
recipients.clear();
|
recipients.clear();
|
||||||
Set<Player> spies = new HashSet<>();
|
Set<Player> spies = new HashSet<>();
|
||||||
@ -1052,11 +1052,12 @@ import java.util.regex.Pattern;
|
|||||||
receiver.sendMessage(full);
|
receiver.sendMessage(full);
|
||||||
}
|
}
|
||||||
if (!spies.isEmpty()) {
|
if (!spies.isEmpty()) {
|
||||||
String spyMessage = Captions.PLOT_CHAT_SPY_FORMAT.getTranslated()
|
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
||||||
.replace("%plot_id%", id.getX() + ";" + id.getY()).replace("%sender%", sender)
|
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
||||||
.replace("%msg%", message);
|
Template spysenderTemplate = Template.of("sender", sender);
|
||||||
|
Template spymessageTemplate = Template.of("msg", message);
|
||||||
for (Player player : spies) {
|
for (Player player : spies) {
|
||||||
player.sendMessage(spyMessage);
|
plotPlayer.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Re-implement
|
// TODO: Re-implement
|
||||||
|
@ -162,15 +162,15 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
|
|
||||||
@Override @Nonnegative public int hasPermissionRange(@Nonnull final String stub,
|
@Override @Nonnegative public int hasPermissionRange(@Nonnull final String stub,
|
||||||
@Nonnegative final int range) {
|
@Nonnegative final int range) {
|
||||||
if (hasPermission(Permission.PERMISSION_ADMIN.getTranslated())) {
|
if (hasPermission(Permission.PERMISSION_ADMIN.toString())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
final String[] nodes = stub.split("\\.");
|
final String[] nodes = stub.split("\\.");
|
||||||
final StringBuilder n = new StringBuilder();
|
final StringBuilder n = new StringBuilder();
|
||||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
n.append(nodes[i]).append(".");
|
n.append(nodes[i]).append(".");
|
||||||
if (!stub.equals(n + Permission.PERMISSION_STAR.getTranslated())) {
|
if (!stub.equals(n + Permission.PERMISSION_STAR.toString())) {
|
||||||
if (hasPermission(n + Permission.PERMISSION_STAR.getTranslated())) {
|
if (hasPermission(n + Permission.PERMISSION_STAR.toString())) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package com.plotsquared.bukkit.schematic;
|
package com.plotsquared.bukkit.schematic;
|
||||||
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
|
||||||
import com.sk89q.jnbt.ByteTag;
|
import com.sk89q.jnbt.ByteTag;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.ListTag;
|
import com.sk89q.jnbt.ListTag;
|
||||||
|
@ -27,7 +27,6 @@ package com.plotsquared.core.util.helpmenu;
|
|||||||
|
|
||||||
import com.plotsquared.core.command.Argument;
|
import com.plotsquared.core.command.Argument;
|
||||||
import com.plotsquared.core.command.Command;
|
import com.plotsquared.core.command.Command;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
|
|
||||||
public class HelpObject {
|
public class HelpObject {
|
||||||
|
@ -502,6 +502,12 @@
|
|||||||
"legacyconfig.legacy_config_replaced": "<prefix><gray><value1> has been replaced with <value2></gray>",
|
"legacyconfig.legacy_config_replaced": "<prefix><gray><value1> has been replaced with <value2></gray>",
|
||||||
"legacyconfig.legacy_config_done": "<prefix><green>The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.</green>",
|
"legacyconfig.legacy_config_done": "<prefix><green>The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.</green>",
|
||||||
"legacyconfig.legacy_config_conversion_failed": "<prefix><red>Failed to convert the legacy configuration file. See stack trace for information.</red>",
|
"legacyconfig.legacy_config_conversion_failed": "<prefix><red>Failed to convert the legacy configuration file. See stack trace for information.</red>",
|
||||||
|
|
||||||
|
"update.update_boundary": "<gold>-----------------------------------</gold>",
|
||||||
|
"update.update_notification": "<prefix><gold>There appears to be a PlotSquared update available!</gold>",
|
||||||
|
"update.internal_version": "<prefix><gold>You are running version </gold><dark_aqua><p2version></dark_aqua>",
|
||||||
|
"update.spigot_version": "<prefix><gold>Latest version is </gold><dark_aqua><spigotversion></dark_aqua>",
|
||||||
|
"update.download": "<prefix><gold>Download the update at: <click:open_url:<downloadurl>>",
|
||||||
|
|
||||||
"flag.flag_key": "<gray>Key: <key></gray>",
|
"flag.flag_key": "<gray>Key: <key></gray>",
|
||||||
"flag.flag_desc": "<gray>Desc: <value></gray>",
|
"flag.flag_desc": "<gray>Desc: <value></gray>",
|
||||||
|
Loading…
Reference in New Issue
Block a user