Stefatorus
4 years ago
3 changed files with 157 additions and 157 deletions
@ -1,88 +1,88 @@ |
|||||
<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>com.entryrise</groupId> |
|
||||
<artifactId>afkguard</artifactId> |
|
||||
<version>0.2</version> |
|
||||
<packaging>jar</packaging> |
|
||||
|
|
||||
<name>AFKGuard</name> |
|
||||
<url>http://maven.apache.org</url> |
|
||||
|
|
||||
<properties> |
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|
||||
<plugin.description>Guard against AFKers</plugin.description> |
|
||||
</properties> |
|
||||
|
|
||||
<build> |
|
||||
<finalName>${project.name}</finalName> |
|
||||
<directory>target</directory> |
|
||||
<sourceDirectory>src</sourceDirectory> |
|
||||
<resources> |
|
||||
<resource> |
|
||||
<directory>resources</directory> |
|
||||
<filtering>true</filtering> |
|
||||
<includes> |
|
||||
<include>*</include> |
|
||||
</includes> |
|
||||
</resource> |
|
||||
</resources> |
|
||||
<plugins> |
|
||||
<!-- Set a compiler level --> |
|
||||
<plugin> |
|
||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||
<artifactId>maven-compiler-plugin</artifactId> |
|
||||
<version>2.3.2</version> |
|
||||
<configuration> |
|
||||
<source>1.8</source> |
|
||||
<target>1.8</target> |
|
||||
</configuration> |
|
||||
</plugin> |
|
||||
</plugins> |
|
||||
</build> |
|
||||
|
|
||||
<repositories> |
|
||||
<repository> |
|
||||
<id>spigot-repo</id> |
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> |
|
||||
</repository> |
|
||||
<repository> |
|
||||
<id>mikeprimm-repo</id> |
|
||||
<url>http://repo.mikeprimm.com/</url> |
|
||||
</repository> |
|
||||
<repository> |
|
||||
<id>jitpack.io</id> |
|
||||
<url>https://jitpack.io</url> |
|
||||
</repository> |
|
||||
</repositories> |
|
||||
|
|
||||
<dependencies> |
|
||||
<dependency> |
|
||||
<groupId>org.spigotmc</groupId> |
|
||||
<artifactId>spigot-api</artifactId> |
|
||||
<!-- Peasants don't update or use new features :D --> |
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version> |
|
||||
<scope>provided</scope> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>com.mojang</groupId> |
|
||||
<artifactId>authlib</artifactId> |
|
||||
<version>1.5.13</version> |
|
||||
<scope>provided</scope> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>org.projectlombok</groupId> |
|
||||
<artifactId>lombok</artifactId> |
|
||||
<version>1.18.20</version> |
|
||||
<scope>provided</scope> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>com.github.MilkBowl</groupId> |
|
||||
<artifactId>VaultAPI</artifactId> |
|
||||
<version>1.7</version> |
|
||||
<scope>provided</scope> |
|
||||
</dependency> |
|
||||
</dependencies> |
|
||||
</project> |
|
||||
|
<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>com.entryrise</groupId> |
||||
|
<artifactId>afkguard</artifactId> |
||||
|
<version>1.0.0</version> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<name>AFKGuard</name> |
||||
|
<url>http://maven.apache.org</url> |
||||
|
|
||||
|
<properties> |
||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
|
<plugin.description>Guard against AFKers</plugin.description> |
||||
|
</properties> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.name}</finalName> |
||||
|
<directory>target</directory> |
||||
|
<sourceDirectory>src</sourceDirectory> |
||||
|
<resources> |
||||
|
<resource> |
||||
|
<directory>resources</directory> |
||||
|
<filtering>true</filtering> |
||||
|
<includes> |
||||
|
<include>*</include> |
||||
|
</includes> |
||||
|
</resource> |
||||
|
</resources> |
||||
|
<plugins> |
||||
|
<!-- Set a compiler level --> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-compiler-plugin</artifactId> |
||||
|
<version>2.3.2</version> |
||||
|
<configuration> |
||||
|
<source>1.8</source> |
||||
|
<target>1.8</target> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
<repositories> |
||||
|
<repository> |
||||
|
<id>spigot-repo</id> |
||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> |
||||
|
</repository> |
||||
|
<repository> |
||||
|
<id>mikeprimm-repo</id> |
||||
|
<url>http://repo.mikeprimm.com/</url> |
||||
|
</repository> |
||||
|
<repository> |
||||
|
<id>jitpack.io</id> |
||||
|
<url>https://jitpack.io</url> |
||||
|
</repository> |
||||
|
</repositories> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.spigotmc</groupId> |
||||
|
<artifactId>spigot-api</artifactId> |
||||
|
<!-- Peasants don't update or use new features :D --> |
||||
|
<version>1.8.8-R0.1-SNAPSHOT</version> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.mojang</groupId> |
||||
|
<artifactId>authlib</artifactId> |
||||
|
<version>1.5.13</version> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<version>1.18.20</version> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.github.MilkBowl</groupId> |
||||
|
<artifactId>VaultAPI</artifactId> |
||||
|
<version>1.7</version> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
</project> |
||||
|
@ -1,11 +1,11 @@ |
|||||
name: ${project.name} |
|
||||
author: Stefatorus |
|
||||
version: ${project.version} |
|
||||
api-version: 1.13 |
|
||||
description: ${plugin.description} |
|
||||
main: ${project.groupId}.${project.artifactId}.Main |
|
||||
depend: [Vault] |
|
||||
commands: |
|
||||
${project.name}: |
|
||||
description: command reserved for plugin |
|
||||
|
name: ${project.name} |
||||
|
author: Stefatorus |
||||
|
version: ${project.version} |
||||
|
api-version: 1.16 |
||||
|
description: ${plugin.description} |
||||
|
main: ${project.groupId}.${project.artifactId}.Main |
||||
|
depend: [Vault] |
||||
|
commands: |
||||
|
${project.name}: |
||||
|
description: command reserved for plugin |
||||
|
|
@ -1,59 +1,59 @@ |
|||||
package com.entryrise.afkguard.cmd; |
|
||||
|
|
||||
import org.bukkit.Bukkit; |
|
||||
import org.bukkit.command.Command; |
|
||||
import org.bukkit.command.CommandExecutor; |
|
||||
import org.bukkit.command.CommandSender; |
|
||||
import org.bukkit.entity.Player; |
|
||||
|
|
||||
import com.entryrise.afkguard.Main; |
|
||||
import com.entryrise.afkguard.antiafk.AFKManager; |
|
||||
import com.entryrise.afkguard.utils.MathUtils; |
|
||||
|
|
||||
public class CommandListener implements CommandExecutor { |
|
||||
|
|
||||
private static Set<Player> debug |
|
||||
|
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |
|
||||
Player p = sender instanceof Player ? (Player) sender : null; |
|
||||
|
|
||||
if (p == null) { |
|
||||
sender.sendMessage(Main.PREFIX + "Can't run from console"); |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
if(args.length >= 2 && args[0].equalsIgnoreCase("captcha")) { |
|
||||
Player pl = Bukkit.getPlayer(args[1]); |
|
||||
|
|
||||
if (pl == null) { |
|
||||
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
Main.openCapcha(pl, args.length >= 3 && MathUtils.isInt(args[2]) ? Integer.valueOf(args[2]) : 0); |
|
||||
} else if (args.length >= 3 && args[0].equalsIgnoreCase("setscore")) { |
|
||||
Player pl = Bukkit.getPlayer(args[1]); |
|
||||
|
|
||||
if (pl == null) { |
|
||||
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
AFKManager.setScore(pl, MathUtils.isInt(args[2]) ? Integer.valueOf(args[2]) : 0); |
|
||||
} else if (args.length >= 2 && args[0].equalsIgnoreCase("getscore")) { |
|
||||
Player pl = Bukkit.getPlayer(args[1]); |
|
||||
|
|
||||
if (pl == null) { |
|
||||
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
p.sendMessage(Main.PREFIX + "Player " + pl.getName() + " has score " + AFKManager.getScore(pl)); |
|
||||
} else |
|
||||
|
|
||||
sender.sendMessage(Main.PREFIX + "Valid args: captcha [Player] [Reset Counter], setscore [Player] [Score]"); |
|
||||
return true; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
package com.entryrise.afkguard.cmd; |
||||
|
|
||||
|
import org.bukkit.Bukkit; |
||||
|
import org.bukkit.command.Command; |
||||
|
import org.bukkit.command.CommandExecutor; |
||||
|
import org.bukkit.command.CommandSender; |
||||
|
import org.bukkit.entity.Player; |
||||
|
|
||||
|
import com.entryrise.afkguard.Main; |
||||
|
import com.entryrise.afkguard.antiafk.AFKManager; |
||||
|
import com.entryrise.afkguard.utils.MathUtils; |
||||
|
|
||||
|
public class CommandListener implements CommandExecutor { |
||||
|
|
||||
|
// private static Set<Player> debug
|
||||
|
|
||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |
||||
|
Player p = sender instanceof Player ? (Player) sender : null; |
||||
|
|
||||
|
if (p == null || !p.hasPermission("afkguard.admin")) { |
||||
|
sender.sendMessage(Main.PREFIX + "Can't run from console"); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
if(args.length >= 2 && args[0].equalsIgnoreCase("captcha")) { |
||||
|
Player pl = Bukkit.getPlayer(args[1]); |
||||
|
|
||||
|
if (pl == null) { |
||||
|
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
Main.openCapcha(pl, args.length >= 3 && MathUtils.isInt(args[2]) ? Integer.valueOf(args[2]) : 0); |
||||
|
} else if (args.length >= 3 && args[0].equalsIgnoreCase("setscore")) { |
||||
|
Player pl = Bukkit.getPlayer(args[1]); |
||||
|
|
||||
|
if (pl == null) { |
||||
|
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
AFKManager.setScore(pl, MathUtils.isInt(args[2]) ? Integer.valueOf(args[2]) : 0); |
||||
|
} else if (args.length >= 2 && args[0].equalsIgnoreCase("getscore")) { |
||||
|
Player pl = Bukkit.getPlayer(args[1]); |
||||
|
|
||||
|
if (pl == null) { |
||||
|
p.sendMessage(Main.PREFIX + "That player doesn't exist"); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
p.sendMessage(Main.PREFIX + "Player " + pl.getName() + " has score " + AFKManager.getScore(pl)); |
||||
|
} else |
||||
|
|
||||
|
sender.sendMessage(Main.PREFIX + "Valid args: captcha [Player] [Reset Counter], setscore [Player] [Score]"); |
||||
|
return true; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
Loading…
Reference in new issue