Skip to content

Commit

Permalink
Melhorias diversas #2
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock authored Sep 20, 2024
2 parents fe94b2f + b11f560 commit 19011d0
Show file tree
Hide file tree
Showing 52 changed files with 409 additions and 317 deletions.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
time: "12:00"
timezone: "America/Sao_Paulo"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "12:00"
timezone: "America/Sao_Paulo"
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

name: Build and Upload

on:
push:
branches: [ "master", "dev/*" ]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
check-latest: true
cache: gradle
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build
- name: Upload Plugin
uses: actions/[email protected]
with:
name: PlayerPoints
path: build/libs/*.jar
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
![](https://imgur.com/TFTzDud.png)

PlayerPoints is a plugin that allows management of a primary or secondary economy based around a point system. This is a continuation of the original PlayerPoints plugin by Blackixx which can be found [here](https://github.com/Mitsugaru/PlayerPoints).
PlayerPoints is a plugin that allows management of a primary or secondary economy based around a point system. This is a
continuation of the original PlayerPoints plugin by Blackixx which can be
found [here](https://github.com/Mitsugaru/PlayerPoints).

### Documentation
Any and all information you need for the plugin should already be included [in our Wiki](https://github.com/Rosewood-Development/PlayerPoints/wiki)!

Any and all information you need for the plugin should already be
included [in our Wiki](https://github.com/Rosewood-Development/PlayerPoints/wiki)!

### Support
If there's anything we left out, you have a question, you want to report a bug, or anything else, please [join our Discord server](https://discord.gg/MgUsTBK). We offer any and all support in our server.

If there's anything we left out, you have a question, you want to report a bug, or anything else,
please [join our Discord server](https://discord.gg/MgUsTBK). We offer any and all support in our server.

### Server Compatibility
PlayerPoints is compatible with [Spigot](https://www.spigotmc.org/) and any forks. We recommend using [Paper](https://papermc.io/) to run your server. CraftBukkit servers will not be supported.

PlayerPoints is compatible with [Spigot](https://www.spigotmc.org/) and any forks. We recommend
using [Paper](https://papermc.io/) to run your server. CraftBukkit servers will not be supported.

We support Minecraft versions 1.8.8 and newer.
55 changes: 13 additions & 42 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.gradleup.shadow' version '8.3.2'
id 'java-library'
id 'maven-publish'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'org.black_ixx'
version = '3.2.7'

Expand All @@ -30,17 +28,17 @@ repositories {
}

dependencies {
api 'dev.rosewood:rosegarden:1.4.2'
api(libs.rosewood.rosegarden)

compileOnly 'org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT'
compileOnly 'com.github.milkbowl:vault:1.7.3'
compileOnly 'me.lokka30:treasury-api:1.2.1'
compileOnly 'com.vexsoftware:votifier:2.7.2'
compileOnly 'me.clip:placeholderapi:2.11.3'
compileOnly 'org.jetbrains:annotations:24.0.1'
compileOnly 'me.realized:tokenmanager:3.2.5'
compileOnly 'su.nightexpress:gamepoints:1.3.1'
compileOnly 'su.nexmedia:nexengine:2.2.0'
compileOnly(libs.spigot.api)
compileOnly(libs.vault)
compileOnly(libs.treasury.api)
compileOnly(libs.votifier)
compileOnly(libs.placeholderapi)
compileOnly(libs.annotations)
compileOnly(libs.tokenmanager)
compileOnly(libs.gamepoints)
compileOnly(libs.nexengine)
}

compileJava {
Expand All @@ -50,45 +48,18 @@ compileJava {
}

processResources {
from (sourceSets.main.resources.srcDirs) {
from(sourceSets.main.resources.srcDirs) {
include '**/*.yml'
filter ReplaceTokens, tokens: ["version": project.property("version")]
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
}

shadowJar {
archiveClassifier.set(null)
archiveClassifier.set("")
minimize()

relocate('dev.rosewood.rosegarden', 'org.black_ixx.playerpoints.libs.rosegarden')
}

publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
artifactId = 'playerpoints'
pom {
name = 'playerpoints'
}
}
}
repositories {
if (project.hasProperty('mavenUser') && project.hasProperty('mavenPassword')) {
maven {
credentials {
username project.mavenUser
password project.mavenPassword
}

def releasesRepoUrl = 'https://repo.rosewooddev.io/repository/public-releases/'
def snapshotsRepoUrl = 'https://repo.rosewooddev.io/repository/public-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
}

build.dependsOn shadowJar
publishShadowPublicationToMavenRepository.dependsOn jar
23 changes: 23 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[versions]
rosegarden = "1.4.2"
spigot = "1.21-R0.1-SNAPSHOT"
vault = "1.7.3"
treasury = "1.2.1"
votifier = "2.7.2"
placeholderapi = "2.11.6"
annotations = "24.0.1"
tokenmanager = "3.2.5"
gamepoints = "1.3.1"
nexengine = "2.2.0"

[libraries]
rosewood-rosegarden = { module = "dev.rosewood:rosegarden", version.ref = "rosegarden" }
spigot-api = { module = "org.spigotmc:spigot-api", version.ref = "spigot" }
vault = { module = "com.github.milkbowl:vault", version.ref = "vault" }
treasury-api = { module = "me.lokka30:treasury-api", version.ref = "treasury" }
votifier = { module = "com.vexsoftware:votifier", version.ref = "votifier" }
placeholderapi = { module = "me.clip:placeholderapi", version.ref = "placeholderapi" }
annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }
tokenmanager = { module = "me.realized:tokenmanager", version.ref = "tokenmanager" }
gamepoints = { module = "su.nightexpress:gamepoints", version.ref = "gamepoints" }
nexengine = { module = "su.nexmedia:nexengine", version.ref = "nexengine" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/org/black_ixx/playerpoints/PlayerPoints.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import dev.rosewood.rosegarden.RosePlugin;
import dev.rosewood.rosegarden.config.RoseSetting;
import dev.rosewood.rosegarden.manager.Manager;
import java.util.Arrays;
import java.util.List;
import me.lokka30.treasury.api.common.service.ServiceRegistry;
import me.lokka30.treasury.api.economy.EconomyProvider;
import net.milkbowl.vault.economy.Economy;
Expand All @@ -22,6 +20,9 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.ServicePriority;

import java.util.Arrays;
import java.util.List;

/**
* Main plugin class for PlayerPoints.
*/
Expand All @@ -37,6 +38,10 @@ public PlayerPoints() {
instance = this;
}

public static PlayerPoints getInstance() {
return instance;
}

@Override
public void enable() {
this.api = new PlayerPointsAPI(this);
Expand Down Expand Up @@ -140,7 +145,7 @@ protected List<RoseSetting<?>> getRoseConfigSettings() {

@Override
protected String[] getRoseConfigHeader() {
return new String[] {
return new String[]{
"__________ __ __________ __ __",
"\\______ \\ | _____ ___ __ __________\\______ \\____ |__| _____/ |_ ______",
" | ___/ | \\__ \\< | |/ __ \\_ __ \\ ___/ _ \\| |/ \\ __\\/ ___/",
Expand All @@ -150,10 +155,6 @@ protected String[] getRoseConfigHeader() {
};
}

public static PlayerPoints getInstance() {
return instance;
}

/**
* Get the plugin's API.
*
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/org/black_ixx/playerpoints/PlayerPointsAPI.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.black_ixx.playerpoints;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import org.black_ixx.playerpoints.event.PlayerPointsChangeEvent;
import org.black_ixx.playerpoints.event.PlayerPointsResetEvent;
import org.black_ixx.playerpoints.manager.DataManager;
Expand All @@ -12,10 +8,15 @@
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

/**
* The API for the PlayerPoints plugin.
* Used to manipulate a player's points balance.
*
* <p>
* Note: This API does not send any messages and changes will be saved to the database automatically.
*/
public class PlayerPointsAPI {
Expand All @@ -30,7 +31,7 @@ public PlayerPointsAPI(PlayerPoints plugin) {
* Gives a player a specified amount of points
*
* @param playerId The player to give points to
* @param amount The amount of points to give
* @param amount The amount of points to give
* @return true if the transaction was successful, false otherwise
*/
public boolean give(@NotNull UUID playerId, int amount) {
Expand All @@ -48,7 +49,7 @@ public boolean give(@NotNull UUID playerId, int amount) {
* Gives a collection of players a specified amount of points
*
* @param playerIds The players to give points to
* @param amount The amount of points to give
* @param amount The amount of points to give
* @return true if any transaction was successful, false otherwise
*/
@NotNull
Expand All @@ -66,7 +67,7 @@ public boolean giveAll(@NotNull Collection<UUID> playerIds, int amount) {
* Takes a specified amount of points from a player
*
* @param playerId The player to take points from
* @param amount The amount of points to take
* @param amount The amount of points to take
* @return true if the transaction was successful, false otherwise
*/
public boolean take(@NotNull UUID playerId, int amount) {
Expand Down Expand Up @@ -138,7 +139,7 @@ public boolean pay(@NotNull UUID source, @NotNull UUID target, int amount) {
* Sets a player's points to a specified amount
*
* @param playerId The player to set the points of
* @param amount The amount of points to set to
* @param amount The amount of points to set to
* @return true if the transaction was successful, false otherwise
*/
public boolean set(@NotNull UUID playerId, int amount) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.black_ixx.playerpoints;

import java.util.Collections;
import java.util.List;
import java.util.UUID;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
Expand All @@ -11,6 +8,10 @@
import org.black_ixx.playerpoints.util.PointsUtils;
import org.bukkit.OfflinePlayer;

import java.util.Collections;
import java.util.List;
import java.util.UUID;

/**
* Vault economy layer for PlayerPoints.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.black_ixx.playerpoints.commands;

import dev.rosewood.rosegarden.utils.StringPlaceholders;
import java.util.Collections;
import java.util.List;
import org.black_ixx.playerpoints.PlayerPoints;
import org.black_ixx.playerpoints.manager.CommandManager;
import org.black_ixx.playerpoints.manager.LocaleManager;
Expand All @@ -11,6 +9,9 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.Collections;
import java.util.List;

public class BroadcastCommand extends PointsCommand {

public BroadcastCommand() {
Expand Down
Loading

0 comments on commit 19011d0

Please sign in to comment.