mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Add Premium verification
This commit is contained in:
parent
a3759f93a2
commit
95394ec54f
@ -47,22 +47,8 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManag
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ConsoleColors;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.UpdateUtility;
|
import com.github.intellectualsites.plotsquared.bukkit.util.UpdateUtility;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -100,6 +86,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static com.github.intellectualsites.plotsquared.plot.util.PremiumVerification.getUserID;
|
||||||
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||||
@ -164,6 +151,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
new UpdateUtility(this).updateChecker();
|
new UpdateUtility(this).updateChecker();
|
||||||
|
|
||||||
|
new PremiumVerification();
|
||||||
|
PremiumVerification.isPremium();
|
||||||
|
if (PremiumVerification.isPremium()) {
|
||||||
|
PlotSquared.log(Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID());
|
||||||
|
PlotSquared.log(Captions.PREFIX + "&6Thanks for supporting us :)");
|
||||||
|
} else {
|
||||||
|
PlotSquared.log(Captions.PREFIX + "&6Couldn't verify purchase :(");
|
||||||
|
}
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
new Placeholders(this).register();
|
new Placeholders(this).register();
|
||||||
PlotSquared.log(Captions.PREFIX + "&6PlaceholderAPI found! Hook activated.");
|
PlotSquared.log(Captions.PREFIX + "&6PlaceholderAPI found! Hook activated.");
|
||||||
|
@ -25,6 +25,9 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.github.intellectualsites.plotsquared.plot.util.PremiumVerification.getDownloadID;
|
||||||
|
import static com.github.intellectualsites.plotsquared.plot.util.PremiumVerification.getUserID;
|
||||||
|
|
||||||
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
|
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
|
||||||
description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
||||||
permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE)
|
permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE)
|
||||||
@ -50,6 +53,8 @@ public class DebugPaste extends SubCommand {
|
|||||||
b.append(
|
b.append(
|
||||||
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
|
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
|
||||||
+ "problem\n\n");
|
+ "problem\n\n");
|
||||||
|
b.append("# PlotSquared Information\n");
|
||||||
|
b.append("This PlotSquared version is licensed to the spigot user ").append(getUserID()).append(" under ").append(getDownloadID()).append("\n");
|
||||||
b.append("# Server Information\n");
|
b.append("# Server Information\n");
|
||||||
b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation())
|
b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation())
|
||||||
.append("\n");
|
.append("\n");
|
||||||
|
@ -6,21 +6,18 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||||
|
|
||||||
|
import static com.github.intellectualsites.plotsquared.plot.util.PremiumVerification.isPremium;
|
||||||
|
|
||||||
@CommandDeclaration(command = "plugin", permission = "plots.use",
|
@CommandDeclaration(command = "plugin", permission = "plots.use",
|
||||||
description = "Show plugin information", usage = "/plot plugin", aliases = "version",
|
description = "Show plugin information", usage = "/plot plugin", aliases = "version",
|
||||||
category = CommandCategory.INFO) public class PluginCmd extends SubCommand {
|
category = CommandCategory.INFO) public class PluginCmd extends SubCommand {
|
||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
TaskManager.IMP.taskAsync(new Runnable() {
|
TaskManager.IMP.taskAsync(() -> {
|
||||||
@Override public void run() {
|
MainUtil.sendMessage(player, String.format("$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)", PlotSquared.get().getVersion()));
|
||||||
MainUtil.sendMessage(player, String.format(
|
MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault");
|
||||||
"$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)",
|
MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki");
|
||||||
PlotSquared.get().getVersion()));
|
MainUtil.sendMessage(player, "$2>> $1&lPremium$2: $1" + isPremium());
|
||||||
MainUtil.sendMessage(player,
|
|
||||||
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault");
|
|
||||||
MainUtil.sendMessage(player,
|
|
||||||
"$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
|
public class PremiumVerification {
|
||||||
|
private static Boolean usingPremium;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Account ID if downloaded through SpigotMC
|
||||||
|
*/
|
||||||
|
public static String getUserID() {
|
||||||
|
return "%%__USER__%%";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Download ID if downloaded through SpigotMC
|
||||||
|
*/
|
||||||
|
public static String getDownloadID() {
|
||||||
|
return "%%__NONCE__%%";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param userID Spigot user ID
|
||||||
|
* @return true if userID does not contain __USER__
|
||||||
|
*/
|
||||||
|
private static Boolean isPremium(String userID) {
|
||||||
|
return !userID.contains("__USER__");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this plugin is premium
|
||||||
|
*/
|
||||||
|
public static Boolean isPremium() {
|
||||||
|
return usingPremium == null ? isPremium(getUserID()) : usingPremium;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user