-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recoding is coming along nicely. GrimList is now compatible with UUIDs. Currently, only playerdata.yml can be used to store playerdata. Other methods coming soon. Wanted to get something released as quickly as I could. Much more testing to be done before uploading to BukkitDev.
- Loading branch information
FerusGrim
committed
Apr 29, 2014
1 parent
0e26905
commit 3e62bb0
Showing
23 changed files
with
1,928 additions
and
36 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,36 +1,5 @@ | ||
################# | ||
## Eclipse | ||
################# | ||
|
||
*.pydevproject | ||
.project | ||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.classpath | ||
.settings/ | ||
.loadpath | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
*.launch | ||
|
||
# CDT-specific | ||
.cproject | ||
|
||
# PDT-specific | ||
.buildpath | ||
|
||
########### | ||
## MY STUFF | ||
########### | ||
*.jar | ||
*.bat | ||
resources/ | ||
.idea/ | ||
M_LOG | ||
*.iml | ||
target/ | ||
*.bat |
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,79 @@ | ||
<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>io.github.ferusgrim</groupId> | ||
<artifactId>grimlist</artifactId> | ||
<version>3.0.1</version> | ||
<name>GrimList</name> | ||
<description>Whitelisting plugin for the Bukkit API.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
<repositories> | ||
<repository> | ||
<id>bukkit-repo</id> | ||
<url>http://repo.bukkit.org/content/groups/public/</url> | ||
</repository> | ||
<repository> | ||
<id>gravity-repo</id> | ||
<url>http://repo.gravitydevelopment.net</url> | ||
</repository> | ||
<repository> | ||
<id>Plugin Metrics</id> | ||
<url>http://repo.mcstats.org/content/repositories/public</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.bukkit</groupId> | ||
<artifactId>bukkit</artifactId> | ||
<version>LATEST</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.gravitydevelopment.updater</groupId> | ||
<artifactId>updater</artifactId> | ||
<version>2.2</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mcstats.bukkit</groupId> | ||
<artifactId>metrics</artifactId> | ||
<version>R7</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>1.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<relocations> | ||
<relocation> | ||
<pattern>net.gravitydevelopment.updater.Updater</pattern> | ||
<shadedPattern>lib.net.gravitydevelopment.updater.Updater</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.mcstats</pattern> | ||
<shadedPattern>lib.org.mcstats</shadedPattern> | ||
</relocation> | ||
</relocations> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
101 changes: 101 additions & 0 deletions
101
src/main/java/io/github/ferusgrim/GrimList/Commands/AddPlayer.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,101 @@ | ||
/** | ||
* @author FerusGrim | ||
* @website http://ferusgrim.github.io/ | ||
* Copyright under GPLv3 to Nicholas Badger (FerusGrim) - 2014 | ||
*/ | ||
|
||
package io.github.ferusgrim.GrimList.Commands; | ||
|
||
import io.github.ferusgrim.GrimList.utils.UUIDFetcher; | ||
import io.github.ferusgrim.GrimList.utils.AsyncThenSyncOperation; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
import io.github.ferusgrim.GrimList.GrimList; | ||
import io.github.ferusgrim.GrimList.FocusManagers.FileManager; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public class AddPlayer { | ||
private GrimList plugin; | ||
|
||
public AddPlayer(GrimList plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
public boolean run(CommandSender sender, String name){ | ||
switch(plugin.focusOn) { | ||
case "file": | ||
String uuid = plugin.filem.getUUID(name); | ||
if (uuid.isEmpty()) { | ||
runOperation(sender, name); | ||
} else { | ||
if (plugin.filem.alreadyOnWhitelist(uuid)) { | ||
if (sender instanceof Player) { | ||
sender.sendMessage(plugin.mStart + "'" + name + "' is already whitelisted!"); | ||
} else { | ||
plugin.log("WARNING", "'" + name + "' is already whitelisted!"); | ||
} | ||
} else { | ||
plugin.filem.toggleIsWhitelisted(uuid, name); | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "'" + name + "' was added to the whitelist!"); | ||
}else{ | ||
plugin.log("INFO", "'" + name + "' was added to the whitelist!"); | ||
} | ||
} | ||
} | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
private void runOperation(CommandSender sender, String name){ | ||
new AsyncThenSyncOperation(plugin, true){ | ||
private Map<String, UUID> response = null; | ||
|
||
@Override | ||
protected void execAsyncFirst() { | ||
try{ | ||
response = new UUIDFetcher(Arrays.asList(name.toLowerCase())).call(); | ||
}catch(Exception e){ | ||
plugin.log("WARNING", "Exception while running UUIDFetcher!"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void execSyncThen() { | ||
if(response.get(name.toLowerCase()) == null){ | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "UUID Query returned null! Invalid username?"); | ||
}else{ | ||
plugin.log("WARNING", "UUID Query returned null! Username might not exist.?"); | ||
} | ||
return; | ||
} | ||
String uuid = response.get(name.toLowerCase()).toString(); | ||
switch(plugin.focusOn) { | ||
case "file": | ||
if(plugin.filem.alreadyOnWhitelist(uuid)){ | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "'" + name + "' is already whitelisted!"); | ||
}else{ | ||
plugin.log("WARNING", "'" + name + "' is already whitelisted!"); | ||
} | ||
}else{ | ||
plugin.filem.toggleIsWhitelisted(uuid, name); | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "'" + name + "' was added to the whitelist!"); | ||
}else{ | ||
plugin.log("INFO", "'" + name + "' was added to the whitelist!"); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
}; | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
src/main/java/io/github/ferusgrim/GrimList/Commands/DeleteRecord.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,104 @@ | ||
/** | ||
* @author FerusGrim | ||
* @website http://ferusgrim.github.io/ | ||
* Copyright under GPLv3 to Nicholas Badger (FerusGrim) - 2014 | ||
*/ | ||
|
||
package io.github.ferusgrim.GrimList.Commands; | ||
|
||
import io.github.ferusgrim.GrimList.GrimList; | ||
|
||
import io.github.ferusgrim.GrimList.utils.AsyncThenSyncOperation; | ||
import io.github.ferusgrim.GrimList.utils.UUIDFetcher; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public class DeleteRecord { | ||
private GrimList plugin; | ||
|
||
public DeleteRecord(GrimList plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
public boolean run(CommandSender sender, String name) { | ||
switch(plugin.focusOn){ | ||
case "file": | ||
String uuid = plugin.filem.getUUID(name); | ||
if(uuid.isEmpty()){ | ||
runOperation(sender, name); | ||
}else{ | ||
if(plugin.filem.recordExists(uuid)){ | ||
plugin.filem.deleteRecord(uuid); | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "Deleted '" + name + "'s record."); | ||
sender.sendMessage(plugin.mStart + "UUID: ('" + uuid + "')"); | ||
}else{ | ||
plugin.log("INFO", "Deleted '" + name + "'s record."); | ||
plugin.log("INFO", "UUID: ('" + uuid + "')"); | ||
} | ||
}else{ | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "No record found for '" + name + "'!"); | ||
}else{ | ||
plugin.log("INFO", "No record found for '" + name + "'!"); | ||
} | ||
} | ||
} | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
private void runOperation(CommandSender sender, String name) { | ||
new AsyncThenSyncOperation(plugin, true) { | ||
private Map<String, UUID> response = null; | ||
|
||
@Override | ||
protected void execAsyncFirst() { | ||
try { | ||
response = new UUIDFetcher(Arrays.asList(name.toLowerCase())).call(); | ||
} catch (Exception e) { | ||
plugin.log("WARNING", "Exception while running UUIDFetcher!"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void execSyncThen() { | ||
if (response.get(name.toLowerCase()) == null) { | ||
if (sender instanceof Player) { | ||
sender.sendMessage(plugin.mStart + "UUID Query returned null! Invalid username?"); | ||
} else { | ||
plugin.log("WARNING", "UUID Query returned null! Username might not exist.?"); | ||
} | ||
return; | ||
} | ||
String uuid = response.get(name.toLowerCase()).toString(); | ||
switch (plugin.focusOn) { | ||
case "file": | ||
if(plugin.filem.recordExists(uuid)){ | ||
plugin.filem.deleteRecord(uuid); | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "Deleted '" + name + "'s record."); | ||
sender.sendMessage(plugin.mStart + "UUID: ('" + uuid + "')"); | ||
}else{ | ||
plugin.log("INFO", "Deleted '" + name + "'s record."); | ||
plugin.log("INFO", "UUID: ('" + uuid + "')"); | ||
} | ||
}else{ | ||
if(sender instanceof Player){ | ||
sender.sendMessage(plugin.mStart + "No record found for '" + name + "'!"); | ||
}else{ | ||
plugin.log("INFO", "No record found for '" + name + "'!"); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
}; | ||
} | ||
} |
Oops, something went wrong.