diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index b1f047328..a382e675a 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -27,8 +27,8 @@ package com.plotsquared.core.listener; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.StaticCaption; -import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.events.PlotFlagRemoveEvent; @@ -63,6 +63,7 @@ import com.plotsquared.core.plot.flag.implementations.WeatherFlag; import com.plotsquared.core.plot.flag.types.TimedFlag; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.Permissions; +import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskTime; import com.sk89q.worldedit.world.gamemode.GameMode; @@ -76,7 +77,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.UUID; import java.util.function.Consumer; @@ -296,16 +296,15 @@ public class PlotListener { lastPlot = lastPlotAccess.get().orElse(null); } if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) { + final UUID plotOwner = plot.getOwnerAbs(); + String owner = PlayerManager.getName(plotOwner, false); + Caption header = TranslatableCaption.of("titles.title_entered_plot"); + Caption subHeader = TranslatableCaption.of("titles.title_entered_plot_sub"); + Template plotTemplate = Template.of("plot", lastPlot.getId().toString()); + Template worldTemplate = Template.of("world", player.getLocation().getWorldName()); + Template ownerTemplate = Template.of("owner", owner); final Consumer userConsumer = user -> player - .sendTitle(TranslatableCaption.of("titles.title_entered_plot"), - TranslatableCaption.of("titles.title_entered_plot_sub"), - Templates.of("x", lastPlot.getId().getX()), - Templates.of("z", lastPlot.getId().getY()), - Templates.of("world", Objects.requireNonNull(plot.getArea().getId(), "Unknown")), - Templates.of("greeting", greeting), - Templates.of("alias", plot.getAlias()), - Templates.of("owner", user) - ); + .sendTitle(header, subHeader, plotTemplate, worldTemplate, ownerTemplate); UUID uuid = plot.getOwner(); if (uuid == null) { userConsumer.accept("Unknown"); diff --git a/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java b/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java index 85a1bdf54..d5702594d 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlayerMetaDataKeys.java @@ -38,20 +38,20 @@ import java.util.List; public final class PlayerMetaDataKeys { //@formatter:off - public static final MetaDataKey PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral() {}); - public static final MetaDataKey PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral() {}); + public static final MetaDataKey PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral<>() {}); + public static final MetaDataKey PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral<>() {}); - public static final MetaDataKey TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of("ignoreExpireTask", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of("WorldEditRegionPlot", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral() {}); - public static final MetaDataKey> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral>() {}); - public static final MetaDataKey TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral() {}); - public static final MetaDataKey TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral() {}); + public static final MetaDataKey TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of("ignoreExpireTask", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of("WorldEditRegionPlot", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral<>() {}); + public static final MetaDataKey> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral<>() {}); + public static final MetaDataKey TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral<>() {}); //@formatter:on private PlayerMetaDataKeys() { diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 92276ff22..498648915 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -157,7 +157,7 @@ "schematic.schematic_exportall_world": "Invalid world.", "schematics.plot_to_schem": "Plot->Schematic: Found plots...", "error.task_in_process": "Task is already running.", - "titles.title_entered_plot": "Plot: ;;", + "titles.title_entered_plot": "Plot: ;", "titles.title_entered_plot_sub": "Owned by ", "titles.prefix_greeting": ">", "titles.prefix_farewell": ">",