mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-19 04:52:30 +02:00
Cleanup signs, update and xmpp, more to come.
This commit is contained in:
@@ -37,4 +37,4 @@ public class PastieUpload
|
||||
throw new IOException("Failed to upload to pastie.org");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -188,7 +188,7 @@ public class UpdateCheck
|
||||
private int getBukkitVersion()
|
||||
{
|
||||
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(plugin.getServer().getVersion());
|
||||
if (versionMatch.matches())
|
||||
if (versionMatch.matches())
|
||||
{
|
||||
return Integer.parseInt(versionMatch.group(1));
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials.update;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyFactory;
|
||||
@@ -15,6 +16,7 @@ import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -25,7 +27,6 @@ public class UpdateFile
|
||||
private final static String UPDATE_URL = "http://goo.gl/67jev";
|
||||
private final static BigInteger PUBLIC_KEY = new BigInteger("5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", 36);
|
||||
private final transient File file;
|
||||
private transient YamlConfiguration updateConfig;
|
||||
private final transient Plugin plugin;
|
||||
private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>();
|
||||
|
||||
@@ -185,16 +186,14 @@ public class UpdateFile
|
||||
return false;
|
||||
}
|
||||
|
||||
private void readVersions() throws Exception
|
||||
private void readVersions() throws FileNotFoundException, InvalidConfigurationException, IOException
|
||||
{
|
||||
updateConfig = new YamlConfiguration();
|
||||
final YamlConfiguration updateConfig = new YamlConfiguration();
|
||||
updateConfig.load(file);
|
||||
versions.clear();
|
||||
for (String versionString : updateConfig.getKeys(false))
|
||||
{
|
||||
final Version version = new Version(versionString);
|
||||
final VersionInfo info = new VersionInfo(updateConfig, versionString);
|
||||
versions.put(version, info);
|
||||
versions.put(new Version(versionString), new VersionInfo(updateConfig, versionString));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
// TODO: This whole thing should make use of the conversations api
|
||||
public class UpdateProcess implements Listener
|
||||
{
|
||||
private transient Player currentPlayer;
|
||||
|
@@ -61,6 +61,5 @@ public class ConfigCommand extends AbstractFileCommand implements Command
|
||||
player.sendMessage(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,6 @@ public class IrcBot extends PircBot
|
||||
try
|
||||
{
|
||||
connect(SERVER, PORT);
|
||||
return;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
@@ -39,7 +39,7 @@ public abstract class AbstractState
|
||||
|
||||
/**
|
||||
* Check if we already know the answer, so the user does not have to answer the question.
|
||||
*
|
||||
*
|
||||
* @return true, if the answer could be guessed.
|
||||
*/
|
||||
public boolean guessAnswer()
|
||||
@@ -49,12 +49,14 @@ public abstract class AbstractState
|
||||
|
||||
/**
|
||||
* Ask the user the question.
|
||||
* @param sender
|
||||
*
|
||||
* @param sender
|
||||
*/
|
||||
public abstract void askQuestion(Player sender);
|
||||
|
||||
/**
|
||||
* React on the answer and set internal variables
|
||||
*
|
||||
* @param answer
|
||||
* @return true, if the answer could be recognized as a valid answer
|
||||
*/
|
||||
|
@@ -11,7 +11,7 @@ public class EssentialsChat extends AbstractYesNoState
|
||||
{
|
||||
public EssentialsChat(final StateMap states)
|
||||
{
|
||||
super(states, EssentialsChatSettings.class, EssentialsSpawn.class);
|
||||
super(states, EssentialsChatSettings.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -7,7 +7,7 @@ public class EssentialsChatSettings extends AbstractYesNoState
|
||||
{
|
||||
public EssentialsChatSettings(final StateMap states)
|
||||
{
|
||||
super(states, EssentialsSpawn.class);
|
||||
super(states, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -44,4 +44,4 @@ public class EssentialsGeoIP extends AbstractYesNoState
|
||||
}
|
||||
listener.onWorkDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,4 +44,4 @@ public class EssentialsProtect extends AbstractYesNoState
|
||||
}
|
||||
listener.onWorkDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,47 +0,0 @@
|
||||
package com.earth2me.essentials.update.states;
|
||||
|
||||
import com.earth2me.essentials.update.AbstractWorkListener;
|
||||
import com.earth2me.essentials.update.tasks.InstallModule;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class EssentialsSpawn extends AbstractYesNoState
|
||||
{
|
||||
public EssentialsSpawn(final StateMap states)
|
||||
{
|
||||
super(states, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean guessAnswer()
|
||||
{
|
||||
final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsSpawn");
|
||||
if (plugin != null)
|
||||
{
|
||||
setAnswer(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askQuestion(final Player sender)
|
||||
{
|
||||
sender.sendMessage("Do you want to install EssentialsSpawn? (yes/no)");
|
||||
sender.sendMessage("EssentialsSpawn lets you control player spawning");
|
||||
sender.sendMessage("It allows you to set different places where players spawn on death, new players join and allows players to return to spawn.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(final AbstractWorkListener listener)
|
||||
{
|
||||
if (getAnswer())
|
||||
{
|
||||
new InstallModule(listener, "EssentialsSpawn").start();
|
||||
return;
|
||||
}
|
||||
listener.onWorkDone();
|
||||
}
|
||||
}
|
@@ -6,11 +6,16 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
public class InstallationFinishedEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user