Remove WelcomeTask
This commit is contained in:
parent
0a012a395b
commit
67b9c2c8ba
|
|
@ -2011,12 +2011,6 @@ public class GriefPrevention extends JavaPlugin
|
|||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WelcomeTask task = new WelcomeTask(otherPlayer);
|
||||
task.run();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//claimslist or claimslist <player>
|
||||
|
|
|
|||
|
|
@ -170,20 +170,6 @@ class PlayerEventHandler implements Listener
|
|||
playerData.noChatLocation = player.getLocation();
|
||||
}
|
||||
|
||||
//if player has never played on the server before...
|
||||
if (!player.hasPlayedBefore())
|
||||
{
|
||||
//may need pvp protection
|
||||
instance.checkPvpProtectionNeeded(player);
|
||||
|
||||
//if in survival claims mode, send a message about the claim basics video (except for admins - assumed experts)
|
||||
if (instance.config_claims_worldModes.get(player.getWorld()) == ClaimsMode.Survival && !player.hasPermission("griefprevention.adminclaims") && this.dataStore.claims.size() > 10)
|
||||
{
|
||||
WelcomeTask task = new WelcomeTask(player);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, task, instance.config_claims_manualDeliveryDelaySeconds * 20L);
|
||||
}
|
||||
}
|
||||
|
||||
//silence notifications when they're coming too fast
|
||||
if (event.getJoinMessage() != null && this.shouldSilenceNotification())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
|
||||
public class WelcomeTask implements Runnable
|
||||
{
|
||||
private final Player player;
|
||||
|
||||
public WelcomeTask(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
//abort if player has logged out since this task was scheduled
|
||||
if (!this.player.isOnline()) return;
|
||||
|
||||
//offer advice and a helpful link
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.AvoidGriefClaimLand);
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
|
||||
|
||||
//give the player a reference book for later
|
||||
if (GriefPrevention.instance.config_claims_supplyPlayerManual)
|
||||
{
|
||||
ItemFactory factory = Bukkit.getItemFactory();
|
||||
BookMeta meta = (BookMeta) factory.getItemMeta(Material.WRITTEN_BOOK);
|
||||
|
||||
DataStore datastore = GriefPrevention.instance.dataStore;
|
||||
meta.setAuthor(datastore.getMessage(Messages.BookAuthor));
|
||||
meta.setTitle(datastore.getMessage(Messages.BookTitle));
|
||||
|
||||
StringBuilder page1 = new StringBuilder();
|
||||
String URL = datastore.getMessage(Messages.BookLink, DataStore.SURVIVAL_VIDEO_URL);
|
||||
String intro = datastore.getMessage(Messages.BookIntro);
|
||||
|
||||
page1.append(URL).append("\n\n");
|
||||
page1.append(intro).append("\n\n");
|
||||
String editToolName = GriefPrevention.instance.config_claims_modificationTool.name().replace('_', ' ').toLowerCase();
|
||||
String infoToolName = GriefPrevention.instance.config_claims_investigationTool.name().replace('_', ' ').toLowerCase();
|
||||
String configClaimTools = datastore.getMessage(Messages.BookTools, editToolName, infoToolName);
|
||||
page1.append(configClaimTools);
|
||||
if (GriefPrevention.instance.config_claims_automaticClaimsForNewPlayersRadius < 0)
|
||||
{
|
||||
page1.append(datastore.getMessage(Messages.BookDisabledChestClaims));
|
||||
}
|
||||
|
||||
StringBuilder page2 = new StringBuilder(datastore.getMessage(Messages.BookUsefulCommands)).append("\n\n");
|
||||
page2.append("/Trust /UnTrust /TrustList\n");
|
||||
page2.append("/ClaimsList\n");
|
||||
page2.append("/AbandonClaim\n\n");
|
||||
page2.append("/Claim /ExtendClaim\n");
|
||||
|
||||
page2.append("/IgnorePlayer\n\n");
|
||||
|
||||
page2.append("/SubdivideClaims\n");
|
||||
page2.append("/AccessTrust\n");
|
||||
page2.append("/ContainerTrust\n");
|
||||
page2.append("/PermissionTrust");
|
||||
|
||||
meta.setPages(page1.toString(), page2.toString());
|
||||
|
||||
ItemStack item = new ItemStack(Material.WRITTEN_BOOK);
|
||||
item.setItemMeta(meta);
|
||||
player.getInventory().addItem(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user