This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
forked from Cadiducho/40ServidoresMC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
para hacerlo compatible con diversas plataformas
- Loading branch information
Showing
36 changed files
with
597 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
#Antiguo stuff de NB | ||
/nbproject/private/ | ||
nbproject/ | ||
/build/ | ||
/dist/ | ||
.gradle | ||
.idea | ||
*.iml | ||
|
||
#Maven | ||
/target/ | ||
target/ | ||
\.idea/ | ||
/build/ | ||
/bukkit/build | ||
/common/build | ||
/sponge/build | ||
/bungee/build | ||
|
||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
subprojects { | ||
apply plugin: 'java' | ||
|
||
group = 'com.cadiducho' | ||
version = '3.0' | ||
description = '40ServidoresMC' | ||
java.sourceCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
plugins { | ||
id 'java' | ||
id "com.github.johnrengelman.shadow" version "6.1.0" | ||
id "io.freefair.lombok" version "5.3.0" | ||
} | ||
|
||
repositories { | ||
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } | ||
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' } | ||
} | ||
|
||
dependencies { | ||
implementation project(':common') | ||
implementation 'org.bstats:bstats-bukkit:2.2.1' | ||
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' | ||
compileOnly 'me.clip:placeholderapi:2.10.9' | ||
} | ||
|
||
shadowJar { | ||
archiveBaseName.set(rootProject.name) | ||
archiveClassifier.set('Bukkit') | ||
archiveVersion.set(version) | ||
|
||
relocate 'org.bstats', 'com.cadiducho.cservidoresmc.lib.bstats' | ||
} | ||
|
||
artifacts { | ||
archives shadowJar | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file is generated by the 'io.freefair.lombok' Gradle plugin | ||
config.stopBubbling = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
51 changes: 51 additions & 0 deletions
51
bukkit/src/main/java/com/cadiducho/cservidoresmc/bukkit/cmd/StatsCMD.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.cadiducho.cservidoresmc.bukkit.cmd; | ||
|
||
import com.cadiducho.cservidoresmc.model.ServerStats; | ||
import com.cadiducho.cservidoresmc.model.ServerVote; | ||
import org.bukkit.command.CommandSender; | ||
|
||
import java.util.Collections; | ||
import java.util.logging.Level; | ||
|
||
/** | ||
* Comando para obtener las estadísticas de tu servidor en 40ServidoresMC | ||
* @author Cadiducho | ||
*/ | ||
public class StatsCMD extends CommandBase { | ||
|
||
public StatsCMD() { | ||
super("stats40", "40servidores.stats", Collections.emptyList()); | ||
} | ||
|
||
@Override | ||
public void run(CommandSender sender, String label, String[] args) { | ||
if (!perm(sender, getPermission(), true)) return; | ||
|
||
plugin.getApiClient().fetchServerStats().thenAccept((ServerStats serverStats) -> { | ||
if (serverStats.getServerName() == null) { //clave mal configurada | ||
plugin.sendMessage("&cClave incorrecta. Entra en &bhttps://40servidoresmc.es/miservidor.php &cy cambia esta.", sender); | ||
return; | ||
} | ||
|
||
plugin.sendMessage("&9==> &7" + serverStats.getServerName() + " &festá en el TOP &a" + serverStats.getPosition(), sender); | ||
plugin.sendMessage("&bVotos hoy: &6" + serverStats.getDayVotes(), sender); | ||
plugin.sendMessage("&bVotos premiados hoy: &6" + serverStats.getRewardedDayVotes(), sender); | ||
plugin.sendMessage("&bVotos semanales: &6" + serverStats.getWeekVotes(), sender); | ||
plugin.sendMessage("&bVotos premiados semanales: &6" + serverStats.getRewardedWeekVotes(), sender); | ||
|
||
if (serverStats.getLastVotes() != null) { | ||
StringBuilder usuarios = new StringBuilder(); | ||
for (ServerVote vote : serverStats.getLastVotes()) { | ||
String strellita = vote.isRewarded() ? "&a" : "&c"; | ||
usuarios.append(strellita).append(vote.getName()).append("&6, "); | ||
} | ||
usuarios = new StringBuilder(usuarios.substring(0, usuarios.length() - 2) + "."); | ||
plugin.sendMessage("&bÚltimos 20 votos: " + usuarios, sender); | ||
} | ||
}).exceptionally(ex -> { | ||
plugin.sendMessage("&cHa ocurrido una excepción. Revisa la consola o avisa a un administrador", sender); | ||
plugin.log(Level.SEVERE, "Excepción obteniendo estadisticas: " + ex.getMessage()); | ||
return null; | ||
}); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id "io.freefair.lombok" version "5.3.0" | ||
} | ||
|
||
dependencies { | ||
compileOnly 'com.google.code.gson:gson:2.8.6' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file is generated by the 'io.freefair.lombok' Gradle plugin | ||
config.stopBubbling = true |
Oops, something went wrong.