├── .gitignore ├── pom.xml └── src └── main └── java └── be └── maximvdw └── spigotsite └── api ├── SpigotSite.java ├── SpigotSiteAPI.java ├── exceptions ├── ConnectionFailedException.java ├── PermissionException.java └── SpamWarningException.java ├── forum ├── Forum.java ├── ForumCategory.java ├── ForumManager.java ├── Post.java ├── ProfilePost.java └── Thread.java ├── resource ├── Buyer.java ├── PremiumResource.java ├── Rating.java ├── Resource.java ├── ResourceCategory.java ├── ResourceManager.java └── ResourceUpdate.java └── user ├── Conversation.java ├── ConversationManager.java ├── Medal.java ├── User.java ├── UserManager.java ├── UserRank.java ├── UserStatistics.java └── exceptions ├── EmptyCredentialsException.java ├── InvalidCredentialsException.java └── TwoFactorAuthenticationException.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Xcode template 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.xcuserstate 17 | 18 | 19 | ### Linux template 20 | *~ 21 | 22 | # KDE directory preferences 23 | .directory 24 | 25 | # Linux trash folder which might appear on any partition or disk 26 | .Trash-* 27 | 28 | 29 | ### Eclipse template 30 | *.pydevproject 31 | .metadata 32 | .gradle 33 | bin/ 34 | tmp/ 35 | *.tmp 36 | *.bak 37 | *.swp 38 | *~.nib 39 | local.properties 40 | .settings/ 41 | .loadpath 42 | 43 | # Eclipse Core 44 | .project 45 | 46 | # External tool builders 47 | .externalToolBuilders/ 48 | 49 | # Locally stored "Eclipse launch configurations" 50 | *.launch 51 | 52 | # CDT-specific 53 | .cproject 54 | 55 | # JDT-specific (Eclipse Java Development Tools) 56 | .classpath 57 | 58 | # Java annotation processor (APT) 59 | .factorypath 60 | 61 | # PDT-specific 62 | .buildpath 63 | 64 | # sbteclipse plugin 65 | .target 66 | 67 | # TeXlipse plugin 68 | .texlipse 69 | 70 | 71 | ### JetBrains template 72 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion 73 | 74 | *.iml 75 | 76 | ## Directory-based project format: 77 | .idea/ 78 | # if you remove the above rule, at least ignore the following: 79 | 80 | # User-specific stuff: 81 | # .idea/workspace.xml 82 | # .idea/tasks.xml 83 | # .idea/dictionaries 84 | 85 | # Sensitive or high-churn files: 86 | # .idea/dataSources.ids 87 | # .idea/dataSources.xml 88 | # .idea/sqlDataSources.xml 89 | # .idea/dynamic.xml 90 | # .idea/uiDesigner.xml 91 | 92 | # Gradle: 93 | # .idea/gradle.xml 94 | # .idea/libraries 95 | 96 | # Mongo Explorer plugin: 97 | # .idea/mongoSettings.xml 98 | 99 | ## File-based project format: 100 | *.ipr 101 | *.iws 102 | 103 | ## Plugin-specific files: 104 | 105 | # IntelliJ 106 | /out/ 107 | 108 | # mpeltonen/sbt-idea plugin 109 | .idea_modules/ 110 | 111 | # JIRA plugin 112 | atlassian-ide-plugin.xml 113 | 114 | # Crashlytics plugin (for Android Studio and IntelliJ) 115 | com_crashlytics_export_strings.xml 116 | crashlytics.properties 117 | crashlytics-build.properties 118 | 119 | 120 | ### Vim template 121 | [._]*.s[a-w][a-z] 122 | [._]s[a-w][a-z] 123 | *.un~ 124 | Session.vim 125 | .netrwhist 126 | 127 | 128 | ### SublimeText template 129 | # cache files for sublime text 130 | *.tmlanguage.cache 131 | *.tmPreferences.cache 132 | *.stTheme.cache 133 | 134 | # workspace files are user-specific 135 | *.sublime-workspace 136 | 137 | # project files should be checked into the repository, unless a significant 138 | # proportion of contributors will probably not be using SublimeText 139 | # *.sublime-project 140 | 141 | # sftp configuration file 142 | sftp-config.json 143 | 144 | 145 | ### OSX template 146 | .DS_Store 147 | .AppleDouble 148 | .LSOverride 149 | 150 | # Icon must end with two \r 151 | Icon 152 | 153 | # Thumbnails 154 | ._* 155 | 156 | # Files that might appear in the root of a volume 157 | .DocumentRevisions-V100 158 | .fseventsd 159 | .Spotlight-V100 160 | .TemporaryItems 161 | .Trashes 162 | .VolumeIcon.icns 163 | 164 | # Directories potentially created on remote AFP share 165 | .AppleDB 166 | .AppleDesktop 167 | Network Trash Folder 168 | Temporary Items 169 | .apdisk 170 | 171 | 172 | ### Windows template 173 | # Windows image file caches 174 | Thumbs.db 175 | ehthumbs.db 176 | 177 | # Folder config file 178 | Desktop.ini 179 | 180 | # Recycle Bin used on file shares 181 | $RECYCLE.BIN/ 182 | 183 | # Windows Installer files 184 | *.cab 185 | *.msi 186 | *.msm 187 | *.msp 188 | 189 | # Windows shortcuts 190 | *.lnk 191 | 192 | 193 | ### Java template 194 | *.class 195 | 196 | # Mobile Tools for Java (J2ME) 197 | .mtj.tmp/ 198 | 199 | # Package Files # 200 | *.jar 201 | *.war 202 | *.ear 203 | 204 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 205 | hs_err_pid* 206 | 207 | 208 | ### Cloud9 template 209 | # Cloud9 IDE - http://c9.io 210 | .c9revisions 211 | .c9 212 | 213 | 214 | ### NetBeans template 215 | nbproject/private/ 216 | nbbuild/ 217 | dist/ 218 | nbdist/ 219 | nbactions.xml 220 | nb-configuration.xml 221 | .nb-gradle/ 222 | 223 | 224 | ### JDeveloper template 225 | # default application storage directory used by the IDE Performance Cache feature 226 | .data/ 227 | 228 | # used for ADF styles caching 229 | temp/ 230 | 231 | # default output directories 232 | classes/ 233 | deploy/ 234 | javadoc/ 235 | 236 | # lock file, a part of Oracle Credential Store Framework 237 | cwallet.sso.lck 238 | 239 | ### Maven template 240 | target/ 241 | pom.xml.tag 242 | pom.xml.releaseBackup 243 | pom.xml.versionsBackup 244 | pom.xml.next 245 | release.properties 246 | dependency-reduced-pom.xml 247 | buildNumber.properties 248 | .mvn/timing.properties 249 | 250 | 251 | ### NotepadPP template 252 | # Notepad++ backups # 253 | *.bak 254 | 255 | 256 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | be.maximvdw 5 | spigotsite-api 6 | 0.3.2-SNAPSHOT 7 | SpigotSite API 8 | Spigot Site API 9 | 10 | 11 | 12 | org.apache.maven.plugins 13 | maven-jar-plugin 14 | 2.3.2 15 | 16 | SpigotSiteAPI 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-javadoc-plugin 22 | 2.10.1 23 | 24 | public 25 | false 26 | 27 | 28 | 29 | aggregate 30 | 31 | aggregate 32 | 33 | package 34 | 35 | public 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | maven-javadoc-plugin 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/SpigotSite.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api; 2 | 3 | public final class SpigotSite { 4 | /* Spigot Site API */ 5 | private static SpigotSiteAPI api = null; 6 | /* Spigot Site API Version */ 7 | private static String version = "0.3.2-SNAPSHOT"; 8 | 9 | /** 10 | * Get spigot site API 11 | * 12 | * @return Spigot site API 13 | */ 14 | public static SpigotSiteAPI getAPI() { 15 | return api; 16 | } 17 | 18 | /** 19 | * Set spigot site API 20 | * 21 | * @param api 22 | * Spigot site API 23 | */ 24 | public static void setAPI(SpigotSiteAPI api) { 25 | SpigotSite.api = api; 26 | } 27 | 28 | /** 29 | * Get spigot site API version 30 | * 31 | * @return API version 32 | */ 33 | public static String getVersion() { 34 | return version; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/SpigotSiteAPI.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api; 2 | 3 | import be.maximvdw.spigotsite.api.forum.ForumManager; 4 | import be.maximvdw.spigotsite.api.resource.ResourceManager; 5 | import be.maximvdw.spigotsite.api.user.ConversationManager; 6 | import be.maximvdw.spigotsite.api.user.UserManager; 7 | 8 | /** 9 | * Spigot Site Application Programmable Interface 10 | * 11 | * @author Maxim Van de Wynckel 12 | */ 13 | public interface SpigotSiteAPI { 14 | /** 15 | * Get spigot user manager 16 | * 17 | * @return {@link be.maximvdw.spigotsite.api.user.UserManager} 18 | */ 19 | UserManager getUserManager(); 20 | 21 | /** 22 | * Get spigot resource manager 23 | * 24 | * @return {@link be.maximvdw.spigotsite.api.resource.ResourceManager} 25 | */ 26 | ResourceManager getResourceManager(); 27 | 28 | /** 29 | * Get spigot forum manager 30 | * 31 | * @return {@link be.maximvdw.spigotsite.api.forum.ForumManager} 32 | */ 33 | ForumManager getForumManager(); 34 | 35 | /** 36 | * Get spigot conversation manager 37 | * 38 | * @return {@link be.maximvdw.spigotsite.api.user.ConversationManager} 39 | */ 40 | ConversationManager getConversationManager(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/exceptions/ConnectionFailedException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.exceptions; 2 | 3 | public class ConnectionFailedException extends Exception { 4 | private static final long serialVersionUID = 648468748L; 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/exceptions/PermissionException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.exceptions; 2 | 3 | /** 4 | * PermissionException 5 | * Created by Maxim on 29/03/2018. 6 | */ 7 | public class PermissionException extends Exception { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/exceptions/SpamWarningException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.exceptions; 2 | 3 | public class SpamWarningException extends RuntimeException { 4 | private static final long serialVersionUID = 854651688L; 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/Forum.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Spigot forum 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface Forum { 11 | /** 12 | * Get sub forums 13 | * 14 | * @return List of {{@link be.maximvdw.spigotsite.api.forum.Forum} 15 | */ 16 | List getSubForums(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/ForumCategory.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Spigot forum category 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface ForumCategory { 11 | /** 12 | * Get forums inside category 13 | * 14 | * @return List of {@link be.maximvdw.spigotsite.api.forum.Forum} 15 | */ 16 | List getForums(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/ForumManager.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 4 | 5 | /** 6 | * Spigot forum manager 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface ForumManager { 11 | /** 12 | * Get forum by identifier 13 | * 14 | * @param id Forum id 15 | * @return {@link be.maximvdw.spigotsite.api.forum.Forum} 16 | * @throws ConnectionFailedException Connection to Spigot failed 17 | */ 18 | Forum getForumById(int id) throws ConnectionFailedException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/Post.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import be.maximvdw.spigotsite.api.user.User; 4 | 5 | /** 6 | * Forum thread reply 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface Post { 11 | /** 12 | * Get the author of the reply 13 | * 14 | * @return Spigot User 15 | */ 16 | User getAuthor(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/ProfilePost.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import be.maximvdw.spigotsite.api.user.User; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * ProfilePost 9 | * Created by Maxim on 28/02/2018. 10 | */ 11 | public interface ProfilePost { 12 | /** 13 | * Get the author of the post 14 | * 15 | * @return Spigot User 16 | */ 17 | User getAuthor(); 18 | 19 | /** 20 | * Get post date 21 | * 22 | * @return post date 23 | */ 24 | Date getPostDate(); 25 | 26 | /** 27 | * Get profile message 28 | * 29 | * @return profile message 30 | */ 31 | String getMessage(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/forum/Thread.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.forum; 2 | 3 | import java.util.List; 4 | 5 | import be.maximvdw.spigotsite.api.user.User; 6 | 7 | /** 8 | * Spigot forum thread 9 | * 10 | * @author Maxim Van de Wynckel 11 | */ 12 | public interface Thread { 13 | /** 14 | * Get thread replies 15 | * 16 | * @return List of {@link be.maximvdw.spigotsite.api.forum.Post} 17 | */ 18 | List getReplies(); 19 | 20 | /** 21 | * Get original post 22 | * 23 | * @return {@link be.maximvdw.spigotsite.api.forum.Post} 24 | */ 25 | Post getOriginalPost(); 26 | 27 | /** 28 | * Get thread creator 29 | * 30 | * @return Thread creator 31 | */ 32 | User getCreator(); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/Buyer.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import be.maximvdw.spigotsite.api.user.User; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * Premium resource Buyer 9 | * 10 | * @author Maxim Van de Wynckel 11 | */ 12 | public interface Buyer extends User { 13 | /** 14 | * Get purchase date time 15 | * 16 | * @return purchase date 17 | */ 18 | Date getPurchaseDateTime(); 19 | 20 | /** 21 | * Get the currency it was bought with 22 | * 23 | * @return currency 24 | */ 25 | String getPurchaseCurrency(); 26 | 27 | /** 28 | * Get the price the buyer paid for 29 | * 30 | * @return purchase price 31 | */ 32 | double getPurchasePrice(); 33 | 34 | /** 35 | * Check if the buyer was actually added by the buyer 36 | * 37 | * @return added by buyer or not 38 | */ 39 | boolean addedByAuthor(); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/PremiumResource.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import java.util.List; 4 | 5 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 6 | import be.maximvdw.spigotsite.api.exceptions.PermissionException; 7 | import be.maximvdw.spigotsite.api.user.User; 8 | 9 | /** 10 | * Spigot Premium Resource 11 | * 12 | * @author Maxim Van de Wynckel 13 | */ 14 | public interface PremiumResource extends Resource { 15 | /** 16 | * Get resource price 17 | * 18 | * @return Price 19 | */ 20 | double getPrice(); 21 | 22 | /** 23 | * Set resource price 24 | * 25 | * @param price Price 26 | */ 27 | void setPrice(double price); 28 | 29 | /** 30 | * Get resource price currency 31 | * 32 | * @return Price currency 33 | */ 34 | String getPriceCurrency(); 35 | 36 | /** 37 | * Set resource price currency 38 | * 39 | * @param currency Price currency 40 | */ 41 | void setPriceCurrency(String currency); 42 | 43 | /** 44 | * Get premium resource buyers 45 | * 46 | * @return Resource buyers 47 | */ 48 | List getBuyers(); 49 | 50 | /** 51 | * Add a buyer to a spigot premium resource 52 | * 53 | * @param user The authenticated plugin author 54 | * @param buyer The buyer 55 | */ 56 | void addBuyer(User user, User buyer) throws ConnectionFailedException; 57 | 58 | /** 59 | * Add a buyer to a spigot premium resource 60 | * 61 | * @param user The authenticated plugin author 62 | * @param userid User identifier 63 | */ 64 | void addBuyer(User user, int userid) throws ConnectionFailedException ,PermissionException; 65 | 66 | /** 67 | * Add a buyer to a spigot premium resource 68 | * 69 | * @param user The authenticated plugin author 70 | * @param username The text username 71 | */ 72 | void addBuyer(User user, String username) throws ConnectionFailedException; 73 | 74 | /** 75 | * Add a buyer to a spigot premium resource 76 | * 77 | * @param user The authenticated plugin author 78 | * @param buyers A list of buyers 79 | */ 80 | void addBuyers(User user, List buyers) throws ConnectionFailedException; 81 | 82 | /** 83 | * Add a buyer to a spigot premium resource 84 | * 85 | * @param user The authenticated plugin author 86 | * @param usernames A list of usernames 87 | */ 88 | void addBuyers(User user, String[] usernames) throws ConnectionFailedException; 89 | 90 | /** 91 | * Check if a specific user is a buyer 92 | * 93 | * @param user User is buyer 94 | * @return is buyer 95 | */ 96 | boolean isBuyer(User user); 97 | 98 | /** 99 | * Get buyer by name 100 | * 101 | * @param name buyer name 102 | * @return buyer 103 | */ 104 | Buyer getBuyerByName(String name); 105 | 106 | /** 107 | * Get buyer by id 108 | * 109 | * @param id id 110 | * @return buyer 111 | */ 112 | Buyer getBuyerByUserId(int id); 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/Rating.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import be.maximvdw.spigotsite.api.user.User; 4 | 5 | /** 6 | * Spigot resource rating 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface Rating { 11 | /** 12 | * Get resource rating 13 | * 14 | * @return Integer between 0 and 5 15 | */ 16 | int getRating(); 17 | 18 | /** 19 | * Get rating author 20 | * 21 | * @return Spigot user 22 | */ 23 | User getAuthor(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/Resource.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import be.maximvdw.spigotsite.api.user.User; 4 | 5 | import java.io.File; 6 | import java.util.List; 7 | 8 | /** 9 | * Spigot Resource 10 | * 11 | * @author Maxim Van de Wynckel 12 | */ 13 | public interface Resource { 14 | /** 15 | * Get resource identifier 16 | * 17 | * @return Resource identifier 18 | */ 19 | public int getResourceId(); 20 | 21 | /** 22 | * Get resource name 23 | * 24 | * @return Resource name 25 | */ 26 | public String getResourceName(); 27 | 28 | /** 29 | * Set resource name 30 | * 31 | * @param name 32 | * Resource name 33 | */ 34 | public void setResourceName(String name); 35 | 36 | /** 37 | * Get last resource version 38 | * 39 | * @return Resource version 40 | */ 41 | public String getLastVersion(); 42 | 43 | /** 44 | * Set last resource version 45 | * 46 | * @param version 47 | * Resource version 48 | */ 49 | public void setLastVersion(String version); 50 | 51 | /** 52 | * Get spigot author of resource 53 | * 54 | * @return Spigot User 55 | */ 56 | public User getAuthor(); 57 | 58 | /** 59 | * Get resource category 60 | * 61 | * @return {@link be.maximvdw.spigotsite.api.resource.ResourceCategory} 62 | */ 63 | public ResourceCategory getResourceCategory(); 64 | 65 | /** 66 | * Get resource download URL 67 | * 68 | * @return Download URL 69 | */ 70 | public String getDownloadURL(); 71 | 72 | /** 73 | * Download the resource 74 | * 75 | * @param output 76 | * Download URL 77 | * @return Downloaded file 78 | */ 79 | public File downloadResource(User user, File output); 80 | 81 | /** 82 | * Is the resource deleted 83 | * 84 | * @return Deleted resource 85 | */ 86 | public boolean isDeleted(); 87 | 88 | /** 89 | * Get resource average rating 90 | * 91 | * @return Resource rating 92 | */ 93 | public int getAverageRating(); 94 | 95 | /** 96 | * Get resource ratings 97 | * 98 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Rating} 99 | */ 100 | public List getRatings(); 101 | 102 | /** 103 | * Get rersource updates 104 | * 105 | * @return List of 106 | * {@link be.maximvdw.spigotsite.api.resource.ResourceUpdate} 107 | */ 108 | public List getResourceUpdates(); 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/ResourceCategory.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Spigot Resource Category 7 | * 8 | * @author Maxim Van de Wynckel 9 | */ 10 | public interface ResourceCategory { 11 | /** 12 | * Get resource category identifier 13 | * 14 | * @return Category Id 15 | */ 16 | public int getCategoryId(); 17 | 18 | /** 19 | * Get spigot resource category name 20 | * 21 | * @return Category name 22 | */ 23 | public String getCategoryName(); 24 | 25 | /** 26 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} 27 | * 28 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 29 | */ 30 | public List getResources(); 31 | 32 | /** 33 | * Get amount of resources 34 | * 35 | * @return Resources count 36 | */ 37 | public int getResourceCount(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/ResourceManager.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | import java.util.List; 4 | 5 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 6 | import be.maximvdw.spigotsite.api.exceptions.PermissionException; 7 | import be.maximvdw.spigotsite.api.user.User; 8 | 9 | /** 10 | * Spigot Resource Manager 11 | * 12 | * @author Maxim Van de Wynckel 13 | */ 14 | public interface ResourceManager { 15 | /** 16 | * Get a {@link be.maximvdw.spigotsite.api.resource.Resource} by identifier 17 | * 18 | * @param resourceid Resource identifier 19 | * @return Spigot Resource 20 | * @throws ConnectionFailedException Connection to Spigot failed 21 | */ 22 | Resource getResourceById(int resourceid) throws ConnectionFailedException; 23 | 24 | /** 25 | * Get a {@link be.maximvdw.spigotsite.api.resource.Resource} by identifier 26 | * 27 | * @param resourceid Resource identifier 28 | * @param user Authenticated spigot user 29 | * @return Spigot Resource 30 | * @throws ConnectionFailedException Connection to Spigot failed 31 | */ 32 | Resource getResourceById(int resourceid, User user) throws ConnectionFailedException; 33 | 34 | /** 35 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} from a 36 | * {@link be.maximvdw.spigotsite.api.user.User} 37 | * 38 | * @param user {@link be.maximvdw.spigotsite.api.user.User} 39 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 40 | * @throws ConnectionFailedException Connection to Spigot failed 41 | */ 42 | List getResourcesByUser(User user) throws ConnectionFailedException; 43 | 44 | /** 45 | * Get new resources since last resource id 46 | * @param lastResourceId last resource id 47 | * @return list of resources 48 | * @throws ConnectionFailedException 49 | */ 50 | List getNewResources(int lastResourceId) throws ConnectionFailedException; 51 | 52 | /** 53 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} from a 54 | * {@link be.maximvdw.spigotsite.api.user.User} 55 | * 56 | * @param user {@link be.maximvdw.spigotsite.api.user.User} 57 | * @param loggedInUser {@link be.maximvdw.spigotsite.api.user.User} used to get hidden plugins 58 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 59 | * @throws ConnectionFailedException Connection to Spigot failed 60 | */ 61 | List getResourcesByUser(User user, User loggedInUser) throws ConnectionFailedException; 62 | 63 | /** 64 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} from a 65 | * {@link be.maximvdw.spigotsite.api.user.User} 66 | * 67 | * @param id User identifier 68 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 69 | * @throws ConnectionFailedException Connection to Spigot failed 70 | */ 71 | List getResourcesByUser(int id) throws ConnectionFailedException; 72 | 73 | /** 74 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} from a 75 | * {@link be.maximvdw.spigotsite.api.user.User} 76 | * 77 | * @param id User identifier 78 | * @param loggedInUser {@link be.maximvdw.spigotsite.api.user.User} used to get hidden plugins 79 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 80 | * @throws ConnectionFailedException Connection to Spigot failed 81 | */ 82 | List getResourcesByUser(int id, User loggedInUser) throws ConnectionFailedException; 83 | 84 | /** 85 | * Get a list of {@link be.maximvdw.spigotsite.api.resource.Resource} bought 86 | * by a {@link be.maximvdw.spigotsite.api.user.User} 87 | * 88 | * @param user Authenticated {@link be.maximvdw.spigotsite.api.user.User} 89 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 90 | * @throws ConnectionFailedException Connection to Spigot failed 91 | */ 92 | List getPurchasedResources(User user) 93 | throws ConnectionFailedException; 94 | 95 | /** 96 | * Get resource categories on spigot 97 | * 98 | * @return List of 99 | * {@link be.maximvdw.spigotsite.api.resource.ResourceCategory} 100 | * @throws ConnectionFailedException Connection to Spigot failed 101 | */ 102 | List getResourceCategories() throws ConnectionFailedException; 103 | 104 | /** 105 | * Get {@link be.maximvdw.spigotsite.api.resource.ResourceCategory} by 106 | * identifier 107 | * 108 | * @param id Resource Category identifier 109 | * @return Resource Category 110 | * @throws ConnectionFailedException Connection to Spigot failed 111 | */ 112 | ResourceCategory getResourceCategoryById(int id) throws ConnectionFailedException; 113 | 114 | /** 115 | * Get all resources from a specific category 116 | * 117 | * @param category List of {@link be.maximvdw.spigotsite.api.resource.Resource} 118 | * @return 119 | * @throws ConnectionFailedException Connection to Spigot failed 120 | */ 121 | List getResourcesByCategory(ResourceCategory category) throws ConnectionFailedException; 122 | 123 | /** 124 | * Get the last version of a resource 125 | * 126 | * @param resourceid Resource identifier 127 | * @return Version string 128 | * @throws ConnectionFailedException Connection to Spigot failed 129 | */ 130 | String getLastVersion(int resourceid) throws ConnectionFailedException; 131 | 132 | /** 133 | * Get premium resource buyers 134 | * 135 | * @param resource Premium resource 136 | * @param user The authenticated author of the plugin 137 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Buyer} 138 | * @throws ConnectionFailedException Connection to Spigot failed 139 | */ 140 | List getPremiumResourceBuyers(PremiumResource resource, 141 | User user) throws ConnectionFailedException; 142 | 143 | /** 144 | * Add a buyer to a spigot premium resource 145 | * 146 | * @param resource Premium resource 147 | * @param user The authenticated plugin author 148 | * @param buyer The buyer 149 | * @throws ConnectionFailedException Connection to Spigot failed 150 | */ 151 | void addBuyer(PremiumResource resource, User user, User buyer) throws ConnectionFailedException; 152 | 153 | /** 154 | * Add a buyer to a spigot premium resource 155 | * 156 | * @param resource Premium resource 157 | * @param user The authenticated plugin author 158 | * @param userid User identifier 159 | * @throws ConnectionFailedException Connection to Spigot failed 160 | */ 161 | void addBuyer(PremiumResource resource, User user, int userid) throws ConnectionFailedException, PermissionException; 162 | 163 | /** 164 | * Add a buyer to a spigot premium resource 165 | * 166 | * @param resource Premium resource 167 | * @param user The authenticated plugin author 168 | * @param username The text username 169 | * @throws ConnectionFailedException Connection to Spigot failed 170 | */ 171 | void addBuyer(PremiumResource resource, User user, String username) throws ConnectionFailedException; 172 | 173 | /** 174 | * Add a buyer to a spigot premium resource 175 | * 176 | * @param resource Premium resource 177 | * @param user The authenticated plugin author 178 | * @param buyers A list of buyers 179 | * @throws ConnectionFailedException Connection to Spigot failed 180 | */ 181 | void addBuyers(PremiumResource resource, User user, List buyers) throws ConnectionFailedException; 182 | 183 | /** 184 | * Add a buyer to a spigot premium resource 185 | * 186 | * @param resource Premium resource 187 | * @param user The authenticated plugin author 188 | * @param usernames A list of usernames 189 | * @throws ConnectionFailedException Connection to Spigot failed 190 | */ 191 | void addBuyers(PremiumResource resource, User user, 192 | String[] usernames) throws ConnectionFailedException; 193 | 194 | /** 195 | * Remove a buyer from a spigot premium resource 196 | * 197 | * @param resource Premium resource 198 | * @param user The authenticated plugin author 199 | * @param buyer Buyer to remove 200 | * @throws ConnectionFailedException Connection to Spigot failed 201 | */ 202 | void removeBuyer(PremiumResource resource, User user, int buyer) throws ConnectionFailedException; 203 | } -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/resource/ResourceUpdate.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.resource; 2 | 3 | /** 4 | * Spigot resource update 5 | * 6 | * @author Maxim Van de Wynckel 7 | */ 8 | public interface ResourceUpdate { 9 | 10 | String getUpdateID(); 11 | 12 | void setUpdateID(String updateID); 13 | 14 | String getTextHeading(); 15 | 16 | void setTextHeading(String textHeading); 17 | 18 | String getArticle(); 19 | 20 | void setArticle(String article); 21 | 22 | String getMessageMeta(); 23 | 24 | void setMessageMeta(String messageMeta); 25 | 26 | String getUpdateLink(); 27 | 28 | void setUpdateLink(String updateLink); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/Conversation.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 7 | import be.maximvdw.spigotsite.api.exceptions.SpamWarningException; 8 | 9 | /** 10 | * Spigot Conversation 11 | * 12 | * @author Maxim Van de Wynckel 13 | */ 14 | public interface Conversation { 15 | /** 16 | * Get the conversation ID 17 | * 18 | * @return ID 19 | */ 20 | int getConverationId(); 21 | 22 | /** 23 | * Get the reply cout 24 | * 25 | * @return Reply count 26 | */ 27 | int getRepliesCount(); 28 | 29 | /** 30 | * Get author of the conversation 31 | * 32 | * @return Author user 33 | */ 34 | User getAuthor(); 35 | 36 | /** 37 | * Get a list of all the participants 38 | * 39 | * @return List of participants 40 | */ 41 | List getParticipants(); 42 | 43 | /** 44 | * Get conversation title 45 | * 46 | * @return Title 47 | */ 48 | String getTitle(); 49 | 50 | /** 51 | * Get if the conversation us unread 52 | * 53 | * @return Unread status 54 | */ 55 | boolean isUnread(); 56 | 57 | /** 58 | * Get the last replier 59 | * 60 | * @return The last User to reply. 61 | */ 62 | User getLastReplier(); 63 | 64 | /** 65 | * Get the last reply date 66 | * 67 | * @return The date of the last reply. 68 | */ 69 | Date getLastReplyDate(); 70 | 71 | /** 72 | * Reply to the conversation 73 | * 74 | * @param user User that is replying 75 | * @param bbCode BB Code string 76 | */ 77 | void reply(User user, String bbCode) throws SpamWarningException, ConnectionFailedException; 78 | 79 | /** 80 | * Leave the conversation 81 | * 82 | * @param user Authenticated user 83 | * @throws ConnectionFailedException Connection to Spigot failed 84 | */ 85 | void leave(User user) throws ConnectionFailedException; 86 | 87 | /** 88 | * Mark conversation as read 89 | * 90 | * @param user Authenticated user 91 | * @throws ConnectionFailedException Connection to Spigot failed 92 | */ 93 | void markAsRead(User user) throws ConnectionFailedException; 94 | 95 | /** 96 | * Mark conversation as unread 97 | * 98 | * @param user Authenticated user 99 | * @throws ConnectionFailedException Connection to Spigot failed 100 | */ 101 | void markAsUnread(User user) throws ConnectionFailedException; 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/ConversationManager.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 7 | import be.maximvdw.spigotsite.api.exceptions.SpamWarningException; 8 | 9 | public interface ConversationManager { 10 | /** 11 | * Get conversations of user 12 | * 13 | * @param user Authenticated {@link be.maximvdw.spigotsite.api.user.User} 14 | * @param count 15 | * @return List of {@link be.maximvdw.spigotsite.api.user.Conversation} 16 | * @throws ConnectionFailedException Connection to Spigot failed 17 | */ 18 | List getConversations(User user, int count) 19 | throws ConnectionFailedException; 20 | 21 | /** 22 | * Reply to a converation 23 | * 24 | * @param conversation Conversation 25 | * @param user Authenticated user 26 | * @param reply Reply BB Code 27 | * @throws ConnectionFailedException Connection to Spigot failed 28 | */ 29 | void replyToConversation(Conversation conversation, User user, 30 | String reply) throws SpamWarningException, ConnectionFailedException; 31 | 32 | /** 33 | * Leave a conversation 34 | * 35 | * @param conversation Conversation 36 | * @param user Authenticated user 37 | * @throws ConnectionFailedException Connection to Spigot failed 38 | */ 39 | void leaveConversation(Conversation conversation, User user) throws ConnectionFailedException; 40 | 41 | /** 42 | * Create a new conversation 43 | * 44 | * @param user Authenticated user that sends the message 45 | * @param recipents Recipents string 46 | * @param title Title BB Code 47 | * @param body Body BB Code 48 | * @param locked Lock the conversation 49 | * @param invite Invite others to the conversation 50 | * @param sticky Set sticky 51 | * @return Conversation 52 | * @throws ConnectionFailedException Connection to Spigot failed 53 | */ 54 | Conversation createConversation(User user, Set recipents, 55 | String title, String body, boolean locked, boolean invite, 56 | boolean sticky) throws SpamWarningException, ConnectionFailedException; 57 | 58 | /** 59 | * Create a new conversation 60 | * 61 | * @param user Authenticated user that sends the message 62 | * @param recipent Username to send it to 63 | * @param title Title BB Code 64 | * @param body Body BB Code 65 | * @param locked Lock the conversation 66 | * @param invite Invite others to the conversation 67 | * @param sticky Set sticky 68 | * @return Conversation 69 | * @throws ConnectionFailedException Connection to Spigot failed 70 | */ 71 | Conversation createConversation(User user, String recipient, 72 | String title, String body, boolean locked, boolean invite, 73 | boolean sticky) throws SpamWarningException, ConnectionFailedException; 74 | 75 | /** 76 | * Create a new conversation 77 | * 78 | * @param user Authenticated user that sends the message 79 | * @param recipent Username to send it to 80 | * @param title Title BB Code 81 | * @param body Body BB Code 82 | * @param locked Lock the conversation 83 | * @param invite Invite others to the conversation 84 | * @return Conversation 85 | * @throws ConnectionFailedException Connection to Spigot failed 86 | */ 87 | Conversation createConversation(User user, String recipient, 88 | String title, String body, boolean locked, boolean invite) throws SpamWarningException, ConnectionFailedException; 89 | 90 | /** 91 | * Mark a conversation as read 92 | * 93 | * @param user Authenticated user 94 | * @param conversation Conversation to mark as read 95 | * @throws ConnectionFailedException Connection to Spigot failed 96 | */ 97 | void markConversationAsRead(User user, Conversation conversation) throws ConnectionFailedException; 98 | 99 | /** 100 | * Mark a conversation as unread 101 | * 102 | * @param user Authenticated user 103 | * @param conversation Conversation to mark as unread 104 | * @throws ConnectionFailedException Connection to Spigot failed 105 | */ 106 | void markConversationAsUnread(User user, Conversation conversation) throws ConnectionFailedException; 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/Medal.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | /** 4 | * Spigot donation medal 5 | * 6 | * @author Maxim Van de Wynckel 7 | */ 8 | public interface Medal { 9 | /** 10 | * Get medal identifier 11 | * 12 | * @return Medal identifier 13 | */ 14 | int getMedalId(); 15 | 16 | /** 17 | * Get medal name 18 | * 19 | * @return Name 20 | */ 21 | String getName(); 22 | 23 | /** 24 | * Get medal description 25 | * 26 | * @return Medal description 27 | */ 28 | String getDescription(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/User.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | import java.util.List; 4 | 5 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 6 | import be.maximvdw.spigotsite.api.exceptions.PermissionException; 7 | import be.maximvdw.spigotsite.api.forum.ProfilePost; 8 | import be.maximvdw.spigotsite.api.resource.Resource; 9 | 10 | /** 11 | * Spigot User 12 | * 13 | * @author Maxim Van de Wynckel 14 | */ 15 | public interface User { 16 | /** 17 | * Get spigot user identifier 18 | * 19 | * @return Spigot user identifier 20 | */ 21 | int getUserId(); 22 | 23 | /** 24 | * Get spigot username 25 | * 26 | * @return Spigot username 27 | */ 28 | String getUsername(); 29 | 30 | /** 31 | * Determine if the spigot user is authenticated and can be used to perform 32 | * private actions. 33 | * 34 | * @return is Authenticated 35 | */ 36 | boolean isAuthenticated(); 37 | 38 | /** 39 | * Get purchased resources 40 | * 41 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 42 | * @throws ConnectionFailedException internet connection failed 43 | */ 44 | List getPurchasedResources() 45 | throws ConnectionFailedException; 46 | 47 | /** 48 | * Get created resources 49 | * 50 | * @return List of {@link be.maximvdw.spigotsite.api.resource.Resource} 51 | */ 52 | List getCreatedResources() throws ConnectionFailedException; 53 | 54 | /** 55 | * Get spigot user statistics 56 | * 57 | * @return {@link be.maximvdw.spigotsite.api.user.UserStatistics} 58 | */ 59 | UserStatistics getUserStatistics() throws ConnectionFailedException; 60 | 61 | /** 62 | * Get spigot user private conversations 63 | * 64 | * @return List of conversation 65 | */ 66 | List getConversations() throws ConnectionFailedException; 67 | 68 | /** 69 | * Get users last activity 70 | * 71 | * @return Last activity string 72 | */ 73 | String getLastActivity(); 74 | 75 | /** 76 | * Check if the user has two factory authentication 77 | * 78 | * @return two factor auth 79 | */ 80 | boolean hasTwoFactorAuthentication(); 81 | 82 | /** 83 | * Get a list of profile posts 84 | * 85 | * @param authenticatedUser The logged in user (required for hidden profiles) 86 | * @param count amount of posts to fetch 87 | * @return list of profile posts 88 | * @throws ConnectionFailedException 89 | */ 90 | List getProfilePosts(User authenticatedUser, int count) throws ConnectionFailedException, PermissionException; 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/UserManager.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | import java.util.List; 4 | 5 | import be.maximvdw.spigotsite.api.exceptions.ConnectionFailedException; 6 | import be.maximvdw.spigotsite.api.exceptions.PermissionException; 7 | import be.maximvdw.spigotsite.api.forum.ProfilePost; 8 | import be.maximvdw.spigotsite.api.user.exceptions.InvalidCredentialsException; 9 | import be.maximvdw.spigotsite.api.user.exceptions.TwoFactorAuthenticationException; 10 | 11 | /** 12 | * Spigot User Manager 13 | * 14 | * @author Maxim Van de Wynckel 15 | */ 16 | public interface UserManager { 17 | /** 18 | * Get {@link be.maximvdw.spigotsite.api.user.User} by identifier 19 | * 20 | * @param userid User identifier 21 | * @return {@link be.maximvdw.spigotsite.api.user.User} 22 | * @throws ConnectionFailedException Connection to Spigot failed 23 | */ 24 | User getUserById(int userid) throws ConnectionFailedException, PermissionException; 25 | 26 | /** 27 | * Get a list of users by their name 28 | * 29 | * @param name Name 30 | * @return List of users 31 | * @throws ConnectionFailedException Connection to Spigot failed 32 | */ 33 | List getUsernamesByName(String name) throws ConnectionFailedException; 34 | 35 | /** 36 | * Get user by name 37 | * 38 | * @param name username 39 | * @return User instance 40 | * @throws ConnectionFailedException Connection to Spigot failed 41 | */ 42 | User getUserByName(String name) throws ConnectionFailedException; 43 | 44 | /** 45 | * Get {@link be.maximvdw.spigotsite.api.user.User} by identifier 46 | * 47 | * @param userid User identifier 48 | * @param user Authenticated {@link be.maximvdw.spigotsite.api.user.User} 49 | * @return {@link be.maximvdw.spigotsite.api.user.User} 50 | * @throws ConnectionFailedException Connection to Spigot failed 51 | */ 52 | User getUserById(int userid, User user) throws ConnectionFailedException, PermissionException; 53 | 54 | /** 55 | * Authenticate a spigot user 56 | * 57 | * @param username Username or Email address 58 | * @param password Password 59 | * @return Authenticated Spigot user 60 | * @throws ConnectionFailedException Connection to Spigot failed 61 | */ 62 | User authenticate(String username, String password) 63 | throws InvalidCredentialsException, TwoFactorAuthenticationException, ConnectionFailedException; 64 | 65 | /** 66 | * Authenticate a spigot user 67 | * 68 | * @param username Username or Email address 69 | * @param password Password 70 | * @param twoFactorAuthenticationSecret Two factory authentication BASE 64 secret 71 | * @return Authenticated Spigot user 72 | * @throws ConnectionFailedException Connection to Spigot failed 73 | */ 74 | User authenticate(String username, String password, String twoFactorAuthenticationSecret) 75 | throws InvalidCredentialsException, TwoFactorAuthenticationException, ConnectionFailedException; 76 | 77 | /** 78 | * Authenticate a spigot user 79 | * 80 | * @param username Username or Email address 81 | * @param password Password 82 | * @param user Logged off user with cookies 83 | * @return Authenticated Spigot user 84 | * @throws ConnectionFailedException Connection to Spigot failed 85 | */ 86 | User authenticate(String username, String password, User user) 87 | throws InvalidCredentialsException, TwoFactorAuthenticationException, ConnectionFailedException; 88 | 89 | 90 | /** 91 | * Log off a spigot user 92 | * 93 | * @param user Authenticated Spigot user 94 | * @throws ConnectionFailedException Connection to Spigot failed 95 | */ 96 | void logOff(User user) throws ConnectionFailedException; 97 | 98 | /** 99 | * Log off a spigot user 100 | * 101 | * @param force Force clear the cookies 102 | * @param user Authenticated Spigot user 103 | * @throws ConnectionFailedException Connection to Spigot failed 104 | */ 105 | void logOff(User user, boolean force) throws ConnectionFailedException; 106 | 107 | /** 108 | * Check if the user is logged in 109 | * 110 | * @param user User to check 111 | * @return logged in boolean 112 | * @throws ConnectionFailedException Connection to Spigot failed 113 | */ 114 | boolean isLoggedIn(User user) throws ConnectionFailedException; 115 | 116 | /** 117 | * Get user ranks 118 | * 119 | * @return List of {@link be.maximvdw.spigotsite.api.user.UserRank} 120 | * @throws ConnectionFailedException Connection to Spigot failed 121 | */ 122 | List getUserRanks() throws ConnectionFailedException; 123 | 124 | /** 125 | * Get users by rank 126 | * 127 | * @param rank 128 | * @return List of {@link be.maximvdw.spigotsite.api.user.User} 129 | * @throws ConnectionFailedException Connection to Spigot failed 130 | */ 131 | List getUsersByRank(UserRank rank) throws ConnectionFailedException; 132 | 133 | /** 134 | * Get online members 135 | * 136 | * @return List of members 137 | * @throws ConnectionFailedException Connection to Spigot failed 138 | */ 139 | List getOnlineUsers() throws ConnectionFailedException; 140 | 141 | /** 142 | * Get a list of profile posts 143 | * 144 | * @param user The logged in user (required for hidden profiles) 145 | * @param profile The profile you want to get the posts from 146 | * @param count amount of posts to fetch 147 | * @return list of profile posts 148 | * @throws ConnectionFailedException 149 | */ 150 | List getProfilePosts(User user, User profile, int count) throws ConnectionFailedException , PermissionException; 151 | } 152 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/UserRank.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | /** 4 | * Spigot user rank 5 | * 6 | * @author Maxim Van de Wynckel 7 | */ 8 | public interface UserRank { 9 | /** 10 | * Get spigot user rank name 11 | * 12 | * @return Name 13 | */ 14 | public String getName(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/UserStatistics.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user; 2 | 3 | import java.util.Date; 4 | 5 | public interface UserStatistics { 6 | /** 7 | * Get join date on the site 8 | * 9 | * @return Join date 10 | */ 11 | Date getJoinDate(); 12 | 13 | /** 14 | * Get forum post count 15 | * 16 | * @return Post count 17 | */ 18 | int getPostCount(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/exceptions/EmptyCredentialsException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user.exceptions; 2 | 3 | public class EmptyCredentialsException extends RuntimeException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | @Override 7 | public String getMessage() { 8 | return "Username or Password not entered!"; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/exceptions/InvalidCredentialsException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user.exceptions; 2 | 3 | public class InvalidCredentialsException extends Exception { 4 | private static final long serialVersionUID = 7400895136050445529L; 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/be/maximvdw/spigotsite/api/user/exceptions/TwoFactorAuthenticationException.java: -------------------------------------------------------------------------------- 1 | package be.maximvdw.spigotsite.api.user.exceptions; 2 | 3 | public class TwoFactorAuthenticationException extends Exception { 4 | private static final long serialVersionUID = 7400895325350445529L; 5 | 6 | } 7 | --------------------------------------------------------------------------------