mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Changing the directory
This commit is contained in:
parent
b41aee4fda
commit
f0d8a2979d
@ -0,0 +1,18 @@
|
|||||||
|
package com.bukkit.nossr50.vPlayersOnline;
|
||||||
|
|
||||||
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vPlayersOnline block listener
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class POBlockListener extends BlockListener {
|
||||||
|
private final vPlayersOnline plugin;
|
||||||
|
|
||||||
|
public POBlockListener(final vPlayersOnline plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
//put all Block related code here
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.bukkit.nossr50.vPlayersOnline;
|
||||||
|
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle events for all Player related events
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class POPlayerListener extends PlayerListener {
|
||||||
|
private final vPlayersOnline plugin;
|
||||||
|
|
||||||
|
public POPlayerListener(vPlayersOnline instance) {
|
||||||
|
this.plugin = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Insert Player related code here
|
||||||
|
public void onPlayerJoin(PlayerEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Player players[] = plugin.getServer().getOnlinePlayers();
|
||||||
|
int x = 0;
|
||||||
|
for(Player herp: players){
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
player.sendMessage("There are " + x + " players online");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.bukkit.nossr50.vPlayersOnline;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.bukkit.Player;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayersOnline for Bukkit
|
||||||
|
*
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class vPlayersOnline extends JavaPlugin {
|
||||||
|
private final POPlayerListener playerListener = new POPlayerListener(this);
|
||||||
|
private final POBlockListener blockListener = new POBlockListener(this);
|
||||||
|
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
||||||
|
public final static String name = "vPlayersOnline";
|
||||||
|
public final static String version = "1.0";
|
||||||
|
|
||||||
|
|
||||||
|
public vPlayersOnline(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
||||||
|
super(pluginLoader, instance, desc, plugin, cLoader);
|
||||||
|
|
||||||
|
// TODO: Place any custom initialization code here
|
||||||
|
|
||||||
|
// NOTE: Event registration should be done in onEnable not here as all events are unregistered when a plugin is disabled
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
// TODO: Place any custom enable code here including the registration of any events
|
||||||
|
// Register our events
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||||
|
PluginManager pm = getServer().getPluginManager();
|
||||||
|
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
||||||
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
|
}
|
||||||
|
public void onDisable() {
|
||||||
|
// TODO: Place any custom disable code here
|
||||||
|
|
||||||
|
// NOTE: All registered events are automatically unregistered when a plugin is disabled
|
||||||
|
|
||||||
|
// EXAMPLE: Custom code, here we just output some info so we can check all is well
|
||||||
|
System.out.println("Goodbye world!");
|
||||||
|
}
|
||||||
|
public boolean isDebugging(final Player player) {
|
||||||
|
if (debugees.containsKey(player)) {
|
||||||
|
return debugees.get(player);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDebugging(final Player player, final boolean value) {
|
||||||
|
debugees.put(player, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user