Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Puyttre/SimpleVoteListener
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: ChewMC/SimpleVoteListener
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 9 files changed
  • 1 contributor

Commits on Jul 13, 2020

  1. Fix folder structure

    Chew committed Jul 13, 2020
    Copy the full SHA
    140872a View commit details

Commits on Jul 29, 2020

  1. replicate pom

    Chew committed Jul 29, 2020
    Copy the full SHA
    e740fc3 View commit details
  2. Minor tweaks

    Chew committed Jul 29, 2020
    Copy the full SHA
    5a642b2 View commit details
  3. Copy the full SHA
    a406860 View commit details
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -28,6 +28,12 @@ local.properties
# PDT-specific
.buildpath

#################
## IntelliJ IDEA
#################

.idea/
*.iml

#################
## Visual Studio
30 changes: 0 additions & 30 deletions me/puyttre/svl/Messager.java

This file was deleted.

82 changes: 82 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.puyttre.svl</groupId>
<artifactId>SimpleVoteListener</artifactId>
<version>3.0</version>
<name>SimpleVoteListener</name>
<packaging>jar</packaging>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>bintray-repo</id>
<url>https://dl.bintray.com/ichbinjoe/public/</url>
</repository>
</repositories>
<dependencies>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!--Bukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>nuvotifier-universal</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

public class Commands implements CommandExecutor {

private SimpleVoteListener plugin;
private final SimpleVoteListener plugin;

public Commands(SimpleVoteListener plugin) {
this.plugin = plugin;
@@ -21,7 +21,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
if (cmd.getName().toLowerCase().equals("svl")) {
if (args.length > 0) {
if (args[0].equals("reload")) {
plugin.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "SimpleVoteListener.yml"));
plugin.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "config.yml"));
sender.sendMessage(ChatColor.GREEN + "[SVL] Config reloaded.");
} else {
sender.sendMessage(ChatColor.RED + "Unknown command.");
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

public class JoinEvent implements Listener {

private SimpleVoteListener plugin;
private final SimpleVoteListener plugin;

public JoinEvent(SimpleVoteListener plugin) {
this.plugin = plugin;
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -16,40 +15,38 @@
public class SimpleVoteListener extends JavaPlugin implements Listener {

public FileConfiguration config;
public Messager messager;
private TimedCommand timer;

@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new JoinEvent(this), this);
this.messager = new Messager(this);
this.timer = new TimedCommand(this);

getCommand("svl").setExecutor(new Commands(this));

if (!new File(getDataFolder(), "SimpleVoteListener.yml").exists()) {
saveResource("SimpleVoteListener.yml", false);
if (!new File(getDataFolder(), "config.yml").exists()) {
saveResource("config.yml", false);
loadConfig();
messager.log("Config file not found. Generating a new one for you!");
getLogger().info("Config file not found. Generating a new one for you!");
} else {
loadConfig();
messager.log("Config file found. Using it!");
getLogger().info("Config file found. Using it!");
}
messager.log("SimpleVoteListener 2.4 successfully enabled.");

getLogger().info("SimpleVoteListener 2.4 successfully enabled.");
}

@Override
public void onDisable() {
messager.log("All Offline Players removed from list (Cause: plugin disabled)");
messager.log("Stopping all timed commands...");
getLogger().info("All Offline Players removed from list (Cause: plugin disabled)");
getLogger().info("Stopping all timed commands...");
timer.stopAll();
messager.log("SimpleVoteListener 2.4 successfully disabled.");
getLogger().info("SimpleVoteListener 3.0 successfully disabled.");
}

public void loadConfig() {
this.config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "SimpleVoteListener.yml"));
this.config = this.getConfig();
}

@EventHandler
@@ -61,7 +58,7 @@ public void vote(VotifierEvent e) {
}
}

public Set<String> offline = new HashSet();
public Set<String> offline = new HashSet<>();

public void initOfflineVote(Vote v) {
offline.add(v.getUsername().toLowerCase());
Original file line number Diff line number Diff line change
@@ -7,17 +7,17 @@

public class TimedCommand {

private SimpleVoteListener plugin;
private final SimpleVoteListener plugin;

public Set<String> commands = new HashSet();
public Set<String> commands = new HashSet<>();

public TimedCommand(SimpleVoteListener plugin) {
this.plugin = plugin;
}

public void startTimer(final Vote v, String s) {
if (!s.contains(";")) {
plugin.messager.error("You did not specify a time for the commands to dispatch. eg. 'tell %name% Its been 10 seconds since you voted!;10s'");
plugin.getLogger().warning("You did not specify a time for the commands to dispatch. eg. 'tell %name% It's been 10 seconds since you voted!;10s'");
return;
}
final String[] split = s.split(";");
@@ -29,12 +29,9 @@ public void startTimer(final Vote v, String s) {
} else if (split[1].toLowerCase().endsWith("h")) {
time = ((time * 20) * 60) * 60;
}
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
Bukkit.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), plugin.replaceColor(plugin.replace(split[0], v)));
commands.remove(split[0]);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
Bukkit.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), plugin.replaceColor(plugin.replace(split[0], v)));
commands.remove(split[0]);
}, time);
commands.add(split[0]);
}
File renamed without changes.
File renamed without changes.