Skip to content

Commit

Permalink
Adicionados 5 eventos, mudanças para dar melhor suporte para as versõ…
Browse files Browse the repository at this point in the history
…es mais atuais, entre outros.
  • Loading branch information
Ars3ne committed Mar 23, 2021
1 parent 4d5df1f commit 43b1e6d
Show file tree
Hide file tree
Showing 39 changed files with 4,965 additions and 463 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# aEventos

O ``aEventos`` é um plugin para servidores de Minecraft que traz vários eventos automáticos de forma fácil e rápida. O plugin foi testado apenas na 1.8.X, porém deve funcionar completamente até a 1.12.X. A maioria dos eventos deve funcionar nas versões mais atuais.
O ``aEventos`` é um plugin para servidores de Minecraft que traz vários eventos automáticos de forma fácil e rápida. O plugin foi testado apenas na 1.8.X, mas possui suporte para as versões mais recentes.

## Eventos:
O plugin conta atualmente com ``11`` eventos, que são:
O plugin conta atualmente com ``17`` eventos no total, sendo ``14`` presenciais:
* Sign (Você ganha o evento ao clicar na placa. Com uma configuração, também pode ser usado para Parkour.)
* Campo Minado
* Spleef
Expand All @@ -15,7 +15,14 @@ O plugin conta atualmente com ``11`` eventos, que são:
* Sumo
* Fall (Caso você ainda esteja vivo depois de X segundos do início do evento, você ganha. Pode ser usado para fazer um evento Astronauta, por exemplo.)
* Paintball
* Hunter (Paintball com um sistema de pontos.)
* Quiz
* Anvil

e ``3`` no chat:
* Votação
* Loteria
* Bolão

## Comandos:
|Comando |Descrição |Permissão |
Expand All @@ -33,7 +40,7 @@ O plugin conta atualmente com ``11`` eventos, que são:

## Configurações:

Quando você carregar o plugin pela primeira vez, serão criadas ``12`` configurações de exemplo na pasta ``eventos`` com todos os eventos do plugin. Cada tipo de evento possui suas configurações únicas, mas neste exemplo será configurado o arquivo ``parkour.yml``.
Quando você carregar o plugin pela primeira vez, serão criadas ``18`` configurações de exemplo na pasta ``eventos`` com todos os eventos do plugin. Cada tipo de evento possui suas configurações únicas, mas neste exemplo será configurado o arquivo ``parkour.yml``.

```yml
Evento:
Expand Down
19 changes: 17 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.ars3ne</groupId>
<artifactId>aEventos</artifactId>
<url>https://github.com/ars3ne/aEventos</url>
<version>1.1.0</version>
<version>1.2.0</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand All @@ -31,6 +31,10 @@
<id>bintray-roinujnosde-bukkit-plugins</id>
<url>https://dl.bintray.com/roinujnosde/bukkit-plugins</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>local-maven-repo</id>
<url>file:///${project.basedir}/local-maven-repo</url>
Expand All @@ -57,6 +61,18 @@
<version>1.1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -70,5 +86,4 @@
</build>



</project>
31 changes: 28 additions & 3 deletions src/main/java/com/ars3ne/eventos/aEventos.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
import com.ars3ne.eventos.manager.*;
import com.ars3ne.eventos.utils.ConfigFile;
import com.ars3ne.eventos.utils.ConfigUpdater;
import net.milkbowl.vault.economy.Economy;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
Expand All @@ -54,6 +56,8 @@ public class aEventos extends JavaPlugin {

private SimpleClans clan = null;
private static final LegendChatHook lc_hook = new LegendChatHook();
private Economy econ = null;

private final EventoListener setup_listener = new EventoListener();

@Override
Expand Down Expand Up @@ -107,7 +111,6 @@ private void setupConfig() {

if(!settings.exists()) {

// Presencial
ConfigFile.create("parkour");
ConfigFile.create("campominado");
ConfigFile.create("spleef");
Expand All @@ -120,9 +123,12 @@ private void setupConfig() {
ConfigFile.create("sumo");
ConfigFile.create("astronauta");
ConfigFile.create("paintball");

// Chat
ConfigFile.create("votacao");
ConfigFile.create("hunter");
ConfigFile.create("quiz");
ConfigFile.create("anvil");
ConfigFile.create("loteria");
ConfigFile.create("bolao");

}

Expand All @@ -136,6 +142,9 @@ private void setupConfig() {
e.printStackTrace();
}

// Tenta atualizar os eventos.
ConfigUpdater.updateEventos();

}

private void setupListener() {
Expand All @@ -154,6 +163,9 @@ private void setupAddons() {
if(!setupLegendChat()) {
Bukkit.getConsoleSender().sendMessage("§e[aEventos] §cLegendChat não encontrado.");
}
if(!setupEconomy()) {
Bukkit.getConsoleSender().sendMessage("§e[aEventos] §cVault não encontrado.");
}
}

private boolean setupLegendChat() {
Expand All @@ -173,6 +185,17 @@ private boolean setupSimpleClans() {
return true;
}

private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
public static EventosManager getEventoManager() {
return manager;
}
Expand All @@ -185,6 +208,8 @@ public SimpleClans getSimpleClans() {
return this.clan;
}

public Economy getEconomy() { return this.econ; }

public static aEventos getInstance() {
return (aEventos) Bukkit.getServer().getPluginManager().getPlugin("aEventos");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ars3ne/eventos/api/Evento.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Evento(YamlConfiguration config) {
this.elimination = false;

switch(type) {
case SPLEEF: case BATATA_QUENTE: case FIGHT: case KILLER: case SUMO:
case SPLEEF: case BATATA_QUENTE: case FIGHT: case KILLER: case SUMO: case ANVIL:
this.elimination = true;
break;
}
Expand Down
26 changes: 15 additions & 11 deletions src/main/java/com/ars3ne/eventos/api/EventoChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.ArrayList;
import java.util.List;

public class EventoChat implements EventoInterface{
Expand All @@ -52,12 +53,15 @@ public EventoChat(YamlConfiguration config) {
type = EventoType.getEventoType(config.getString("Evento.Type"));
this.permission = config.getString("Evento.Permission");

if (type == EventoType.VOTACAO) {
this.count_participation = false;
this.count_win = false;
} else {
this.count_participation = config.getBoolean("Evento.Count participation");
this.count_win = config.getBoolean("Evento.Count victory");
switch(type) {
case VOTACAO:
this.count_participation = false;
this.count_win = false;
break;
default:
this.count_participation = config.getBoolean("Evento.Count participation");
this.count_win = config.getBoolean("Evento.Count victory");
break;
}

}
Expand Down Expand Up @@ -90,7 +94,6 @@ public void run() {
List<String> broadcast_messages = config.getStringList("Messages.Broadcast");
for(String s : broadcast_messages) {
parseMessage(s, calls);
//aEventos.getInstance().getServer().broadcastMessage(s.replace("&", "§").replace("@broadcasts", String.valueOf(calls)).replace("@name", config.getString("Evento.Title")));
}

calls--;
Expand All @@ -99,6 +102,9 @@ public void run() {
cancel();
start();

EventoStartedEvent start = new EventoStartedEvent(config.getString("filename").substring(0, config.getString("filename").length() - 4), type);
Bukkit.getPluginManager().callEvent(start);

}
}
}.runTaskTimer(aEventos.getInstance(), 0, config.getInt("Evento.Calls interval") * 20L);
Expand All @@ -116,10 +122,9 @@ public void setWinner(Player p) {

if(!this.count_win) return;

/*List<String> winners = new ArrayList<>();
List<String> winners = new ArrayList<>();
winners.add(p.getUniqueId().toString());
this.win.add(p);

aEventos.getConnectionManager().insertUser(p.getUniqueId());
aEventos.getConnectionManager().addWin(config.getString("filename").substring(0, config.getString("filename").length() - 4), p.getUniqueId());

Expand All @@ -129,7 +134,6 @@ public void setWinner(Player p) {

PlayerWinEvent win = new PlayerWinEvent(p, config.getString("filename").substring(0, config.getString("filename").length() - 4), type);
Bukkit.getPluginManager().callEvent(win);
*/

}

Expand Down
34 changes: 27 additions & 7 deletions src/main/java/com/ars3ne/eventos/api/EventoType.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ public enum EventoType {
FALL,
PAINTBALL,
VOTACAO,
HUNTER,
QUIZ,
ANVIL,
LOTERIA,
BOLAO,
NONE;

public static EventoType getEventoType(String type) {
switch (type) {

// Evento presencial
switch (type.toLowerCase()) {
case "sign":
return EventoType.SIGN;
case "campominado":
Expand All @@ -68,11 +71,18 @@ public static EventoType getEventoType(String type) {
return EventoType.FALL;
case "paintball":
return EventoType.PAINTBALL;

// Evento chat
case "votacao":
return EventoType.VOTACAO;

case "hunter":
return EventoType.HUNTER;
case "quiz":
return EventoType.QUIZ;
case "anvil":
return EventoType.ANVIL;
case "loteria":
return EventoType.LOTERIA;
case "bolao":
return EventoType.BOLAO;
default:
return EventoType.NONE;
}
Expand Down Expand Up @@ -104,14 +114,24 @@ public static String getString(EventoType type) {
return "paintball";
case VOTACAO:
return "votacao";
case HUNTER:
return "hunter";
case QUIZ:
return "quiz";
case ANVIL:
return "anvil";
case LOTERIA:
return "loteria";
case BOLAO:
return "bolao";
default:
return "none";
}
}

public static boolean isEventoChat(EventoType type) {
switch(type) {
case VOTACAO:
case VOTACAO: case LOTERIA: case BOLAO:
return true;
default:
return false;
Expand Down
Loading

0 comments on commit 43b1e6d

Please sign in to comment.