mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Fixed Fillr.java, added /get command ingame
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
7c4860c3b5
commit
891a7dd5f8
1 changed files with 38 additions and 18 deletions
|
@ -1,31 +1,51 @@
|
||||||
package org.bukkit.fillr;
|
package org.bukkit.fillr;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.plugin.*;
|
import org.bukkit.plugin.*;
|
||||||
import org.bukkit.plugin.java.*;
|
import org.bukkit.plugin.java.*;
|
||||||
import org.bukkit.event.*;
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
public class Fillr extends JavaPlugin {
|
public class Fillr extends JavaPlugin {
|
||||||
private Logger log;
|
private FillrListener listener;
|
||||||
private FillrListener listener;
|
public static String name = "Fillr";
|
||||||
public static String name = "Fillr";
|
public static String version = "1.0";
|
||||||
public static String version = "1.0";
|
public static String directory = "plugins";
|
||||||
public static String directory = "plugins";
|
|
||||||
|
|
||||||
public Fillr(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
|
||||||
super(pluginLoader, instance, desc, plugin, cLoader);
|
|
||||||
registerEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisable() {}
|
|
||||||
public void onEnable() {}
|
|
||||||
|
|
||||||
public void registerEvents() {
|
|
||||||
listener = new FillrListener(this.getServer());
|
|
||||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, listener, Event.Priority.Normal, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Fillr(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
||||||
|
super(pluginLoader, instance, desc, plugin, cLoader);
|
||||||
|
registerEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {}
|
||||||
|
public void onEnable() {}
|
||||||
|
|
||||||
|
private void registerEvents() {
|
||||||
|
listener = new FillrListener();
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, listener, Event.Priority.Normal, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class FillrListener extends PlayerListener {
|
||||||
|
@Override
|
||||||
|
public void onPlayerCommand(PlayerChatEvent event) {
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
String[] split = event.getMessage().split(" ", 2);
|
||||||
|
|
||||||
|
if (split[0].equalsIgnoreCase("/get")) {
|
||||||
|
if (split.length == 2) {
|
||||||
|
Getter getter = new Getter(getServer());
|
||||||
|
getter.get(split[1], event.getPlayer());
|
||||||
|
} else {
|
||||||
|
event.getPlayer().sendMessage("Usage: /get (Plugin Name)");
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue