unnamed file

PHP

Keine Beschreibung eingegeben.

Guest

Download Edit

package com.floyd.bukkit.petition;
import java.io.File;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Server;
import org.bukkit.entity.Player;
public class NotifierThread extends Thread
{
private Boolean stop = Boolean.valueOf(false);
private Long interval = Long.valueOf(300000L);
private HashMap<String, Integer> count = new HashMap();
private PetitionPlugin plugin = null;
private String baseDir = \"plugins/PetitionPlugin\";
private Player player = null;
public NotifierThread(PetitionPlugin owner) {
this.plugin = owner;
}
public void run()
{
System.out.println(\"[Pe] NotifierThread started\");
while (!this.stop.booleanValue())
{
try {
sleep(this.interval.longValue());
} catch (InterruptedException e) {
System.out.println(\"[Pe] NotifierThread sleep interrupted\");
}
this.count.clear();
File dir = new File(this.baseDir);
for (String filename : dir.list()) {
if (this.stop.booleanValue()) return;
if (filename.endsWith(\".ticket\")) {
String[] parts = filename.split(\"[\'.\']\");
Integer id = Integer.valueOf(parts[0]);
try {
while (!this.plugin.SetPetitionLock(id, \"*NotifierThread*\", Boolean.valueOf(false)))
try {
Thread.sleep(100L);
}
catch (InterruptedException localInterruptedException1)
{
}
PetitionObject petition = new PetitionObject(id);
if (petition.isValid()) {
Integer found = (Integer)this.count.get(petition.Owner());
if (found == null) found = Integer.valueOf(0);
this.count.put(petition.Owner(), Integer.valueOf(found.intValue() + 1));
}
}
finally {
this.plugin.SetPetitionLock(id, \"*NotifierThread*\", Boolean.valueOf(true));
}
}
}
Integer total = Integer.valueOf(0);
for (String name : this.count.keySet()) {
Integer found = (Integer)this.count.get(name);
total = Integer.valueOf(total.intValue() + found.intValue());
Player p = this.plugin.getServer().getPlayer(name);
if (p != null) {
if (found.intValue() == 1)
p.sendMessage(\"[Pe]