2020-04-16 04:52:39 +02:00
|
|
|
/*
|
2022-06-15 20:17:17 +02:00
|
|
|
* PlotSquared, a land and world management plugin for Minecraft.
|
|
|
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
|
|
|
* Copyright (C) IntellectualSites team and contributors
|
2020-04-16 04:52:39 +02:00
|
|
|
*
|
2022-06-15 20:17:17 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-04-16 04:52:39 +02:00
|
|
|
*
|
2022-06-15 20:17:17 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2020-04-16 04:52:39 +02:00
|
|
|
*
|
2022-06-15 20:17:17 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-04-16 04:52:39 +02:00
|
|
|
*/
|
2020-04-15 21:26:54 +02:00
|
|
|
package com.plotsquared.core.util;
|
2020-02-19 23:55:43 +01:00
|
|
|
|
|
|
|
public class PremiumVerification {
|
2020-07-10 22:12:37 +02:00
|
|
|
|
2020-02-19 23:55:43 +01:00
|
|
|
private static Boolean usingPremium;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Account ID if downloaded through SpigotMC
|
|
|
|
*/
|
|
|
|
public static String getUserID() {
|
|
|
|
return "%%__USER__%%";
|
|
|
|
}
|
|
|
|
|
2020-04-21 23:06:11 +02:00
|
|
|
/**
|
|
|
|
* @return Resource ID if downloaded through SpigotMC
|
|
|
|
*/
|
|
|
|
public static String getResourceID() {
|
|
|
|
return "%%__RESOURCE__%%";
|
|
|
|
}
|
|
|
|
|
2020-02-19 23:55:43 +01:00
|
|
|
/**
|
|
|
|
* @return Download ID if downloaded through SpigotMC
|
|
|
|
*/
|
|
|
|
public static String getDownloadID() {
|
|
|
|
return "%%__NONCE__%%";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param userID Spigot user ID
|
2022-01-24 21:41:54 +01:00
|
|
|
* @return {@code true} if userID does not contain __USER__
|
2020-02-19 23:55:43 +01:00
|
|
|
*/
|
|
|
|
private static Boolean isPremium(String userID) {
|
|
|
|
return !userID.contains("__USER__");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this plugin is premium
|
2020-08-16 14:22:49 +02:00
|
|
|
*
|
2022-01-24 21:41:54 +01:00
|
|
|
* @return {@code true} if is premium
|
2020-02-19 23:55:43 +01:00
|
|
|
*/
|
|
|
|
public static Boolean isPremium() {
|
2020-02-20 00:05:55 +01:00
|
|
|
return usingPremium == null ? (usingPremium = isPremium(getUserID())) : usingPremium;
|
2020-02-19 23:55:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|