Digested Townylearn, and refactored more

This commit is contained in:
alisolarflare 2016-11-03 23:01:12 -04:00
parent 79f909a288
commit fc5141a197
36 changed files with 437 additions and 414 deletions

View file

@ -9,10 +9,10 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.flairdoor.FlairDoorModule;
import alisolarflare.components.gpowers.GPowerModule;
import alisolarflare.components.links.AliLinkModule;
import alisolarflare.events.uhc.UHCModule;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import alisolarflare.magic.MagicModule;
import alisolarflare.minigames.freeforall.FreeForAllModule;
import alisolarflare.minigames.lobby.LobbyModule;
import alisolarflare.minigames.MinigameModule;
import alisolarflare.uhc.UHCModule;
public class AliPresents extends JavaPlugin{
public void onEnable(){
@ -27,8 +27,8 @@ public class AliPresents extends JavaPlugin{
new AliLinkModule().register(this);
new UHCModule().register(this);
new MagicModule().register(this);
new FreeForAllModule().register(this);
new LobbyModule().register(this);
new MinigameModule().register(this);
new CreativeBoundariesModule().register(this);
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");

View file

@ -37,7 +37,6 @@ public class PortalListener implements Listener{
//INIT - Player
Player player = event.getPlayer();
player.sendMessage("MAY THE FLAIRING COMMENCE");
//SANITATION - PlayersToBeFlaired
if(!(playersToBeFlaired.contains(player.getName()))){
@ -53,31 +52,31 @@ public class PortalListener implements Listener{
int z = player.getLocation().getBlockZ();
//INIT - Blocks Under Portal
Block blockTopper = player.getWorld().getBlockAt(x,y-1,z);
Block blockMiddle = player.getWorld().getBlockAt(x,y-2,z);
Block blockBottom = player.getWorld().getBlockAt(x,y-3,z);
Block HigherBlock = player.getWorld().getBlockAt(x,y-1,z);
Block MiddleBlock = player.getWorld().getBlockAt(x,y-2,z);
Block BottomBlock = player.getWorld().getBlockAt(x,y-3,z);
player.sendMessage("Blocks being inspected:");
player.sendMessage(blockTopper.toString());
player.sendMessage(blockMiddle.toString());
player.sendMessage(blockBottom.toString());
player.sendMessage(HigherBlock.toString());
player.sendMessage(MiddleBlock.toString());
player.sendMessage(BottomBlock.toString());
//RECOLOUR PLAYER
if(blockTopper.getType() == Material.STONE){
if(HigherBlock.getType() == Material.STONE){
player.sendMessage("STONE DETECTED");
recolourPlayer(player, DyeColor.GRAY);
//TOP BLOCK IS WOOL?
}else if(blockTopper.getType() == Material.WOOL){
}else if(HigherBlock.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED T");
Wool wool = (Wool) blockTopper.getState().getData();
Wool wool = (Wool) HigherBlock.getState().getData();
recolourPlayer(player, wool.getColor());
//MIDDLE BLOCK IS WOOL?
}else if(blockMiddle.getType() == Material.WOOL){
}else if(MiddleBlock.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED M");
MaterialData mData = blockMiddle.getState().getData();
MaterialData mData = MiddleBlock.getState().getData();
player.sendMessage("MATERIAL DATA COLLECTED: "+ mData.toString());
Wool wool = (Wool) mData;
player.sendMessage("WOOL DATA CONVERTED: "+ wool.toString());
@ -85,9 +84,9 @@ public class PortalListener implements Listener{
recolourPlayer(player, wool.getColor());
//BOTTOM BLOCK IS WOOL?
}else if (blockBottom.getType() == Material.WOOL){
}else if (BottomBlock.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED B");
Wool wool = (Wool) blockBottom.getState().getData();
Wool wool = (Wool) BottomBlock.getState().getData();
recolourPlayer(player, wool.getColor());
}

View file

@ -0,0 +1,23 @@
package alisolarflare.creativeboundaries;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.creativeboundaries.commands.Cbgm0;
import alisolarflare.creativeboundaries.commands.Cbgm1;
import alisolarflare.creativeboundaries.commands.SetDickmode;
public class CreativeBoundariesModule extends Module{
public boolean dickmode;
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new Cbgm1());
registerCommand(plugin, new Cbgm0());
registerCommand(plugin, new SetDickmode(this));
registerListener(plugin, new PlotChangeListener(this));
}
}

View file

@ -1,47 +1,47 @@
package alisolarflare.townylearn;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
public class PlotChangeListener implements Listener{
public boolean isInTown;
public MainPlugin plugin;
public PlotChangeListener(MainPlugin plugin){
this.plugin = plugin;
}
@EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
if (plugin.dickmode == false){
return;
}
try{
Resident currentResident = new Resident(plotEvent.getPlayer().getName().toLowerCase());
TownBlock plot = plotEvent.getTo().getTownBlock();
if(plot.hasTown()){
Town plotTown = plot.getTown();
if(!(plotTown.hasResident(currentResident))){
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
} else {
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
}catch(NotRegisteredException e){
//thrown by plotEvent.getTo().getTownBlock()
//thrown by plotEvent.getTo().getTownBlock().getTown();
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
}
}
package alisolarflare.creativeboundaries;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
public class PlotChangeListener implements Listener{
public boolean isInTown;
public CreativeBoundariesModule plugin;
public PlotChangeListener(CreativeBoundariesModule plugin){
this.plugin = plugin;
}
@EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
if (plugin.dickmode == false){
return;
}
try{
Resident currentResident = new Resident(plotEvent.getPlayer().getName().toLowerCase());
TownBlock plot = plotEvent.getTo().getTownBlock();
if(plot.hasTown()){
Town plotTown = plot.getTown();
if(!(plotTown.hasResident(currentResident))){
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
} else {
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
}catch(NotRegisteredException e){
//thrown by plotEvent.getTo().getTownBlock()
//thrown by plotEvent.getTo().getTownBlock().getTown();
plotEvent.getPlayer().setGameMode(GameMode.SURVIVAL);
}
}
}

View file

@ -0,0 +1,41 @@
package alisolarflare.creativeboundaries.commands;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Cbgm0 extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,74 @@
package alisolarflare.creativeboundaries.commands;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Cbgm1 extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.sendMessage("<EFBFBD>cYou aren't standing in a town or some other error occured.");
player.sendMessage("<EFBFBD>cTownBlock is null.");
return false;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.sendMessage("<EFBFBD>cYou aren't standing in a town or some other error occured.");
player.sendMessage("<EFBFBD>cTownBlock's town is not registered.");
return false;
}
if (town == null) {
player.sendMessage("<EFBFBD>cERROR: The town you're standing in is Null.");
return false;
}
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE);
return true;
}
}
player.sendMessage("Sorry, you're not part of this town");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,54 @@
package alisolarflare.creativeboundaries.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetDickmode extends TBMCCommandBase{
private CreativeBoundariesModule plugin;
public SetDickmode(CreativeBoundariesModule plugin){
this.plugin = plugin;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){
if(args[0] == null){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!");
plugin.dickmode=(true);
return true;
}
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!");
plugin.dickmode=(false);
return true;
}
return false;
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -3,8 +3,8 @@ package alisolarflare.magic;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.magic.aliarrow.AliArrowListener;
import alisolarflare.magic.boombow.BoomBowListener;
import alisolarflare.magic.tricks.AliArrowListener;
import alisolarflare.magic.tricks.BoomBowListener;
public class MagicModule extends Module{

View file

@ -1,4 +1,4 @@
package alisolarflare.magic.aliarrow;
package alisolarflare.magic.tricks;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;

View file

@ -1,4 +1,4 @@
package alisolarflare.magic.aliarrow;
package alisolarflare.magic.tricks;
import org.bukkit.Particle;
import org.bukkit.entity.Arrow;

View file

@ -1,4 +1,4 @@
package alisolarflare.magic.boombow;
package alisolarflare.magic.tricks;
import org.bukkit.GameMode;
import org.bukkit.Location;

View file

@ -1,4 +1,4 @@
package alisolarflare.magic.boombow;
package alisolarflare.magic.tricks;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View file

@ -0,0 +1,33 @@
package alisolarflare.minigames;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.minigames.commands.JoinMinigame;
import alisolarflare.minigames.commands.LeaveMinigame;
import alisolarflare.minigames.commands.ListFighters;
import alisolarflare.minigames.commands.SetColourSpawn;
import alisolarflare.minigames.data.SpawnSet;
public class MinigameModule extends Module{
public SpawnSet spawnSet;
private int GameState;
public List<String> fighters;
@Override
public void register(JavaPlugin plugin) {
this.spawnSet = new SpawnSet();
registerCommand(plugin, new SetColourSpawn(spawnSet));
registerCommand(plugin, new JoinMinigame(this));
registerCommand(plugin, new LeaveMinigame(this));
registerCommand(plugin, new ListFighters(this));
}
public int getGameState() {return GameState;}
public void setGameState(int gameState) {GameState = gameState;}
}

View file

@ -0,0 +1,53 @@
package alisolarflare.minigames.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.MinigameModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class JoinMinigame extends TBMCCommandBase {
private MinigameModule minigame;
public JoinMinigame(MinigameModule minigame) {
this.minigame = minigame;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
String name = sender.getName();
if (minigame.fighters.contains(name)) {
sender.sendMessage("You are already in the minigame!");
return false;
}
minigame.fighters.add(name);
if (minigame.fighters.contains(name)) {
sender.sendMessage("You have joined the minigame!");
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -0,0 +1,53 @@
package alisolarflare.minigames.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.MinigameModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class LeaveMinigame extends TBMCCommandBase {
private MinigameModule lobby;
public LeaveMinigame(MinigameModule lobby) {
this.lobby = lobby;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
}
String name = sender.getName();
if (!(lobby.fighters.contains(name))) {
sender.sendMessage("You are not fighting!");
return false;
}
while(lobby.fighters.contains(name)){
lobby.fighters.remove(name);
}
sender.sendMessage("You have left the fighters category!");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,16 +1,16 @@
package alisolarflare.minigames.lobby.commands;
package alisolarflare.minigames.commands;
import java.util.stream.Collectors;
import org.bukkit.command.CommandSender;
import alisolarflare.minigames.lobby.LobbyModule;
import alisolarflare.minigames.MinigameModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ListFighters extends TBMCCommandBase {
private LobbyModule lobby;
private MinigameModule lobby;
public ListFighters(LobbyModule lobby) {
public ListFighters(MinigameModule lobby) {
this.lobby = lobby;
}

View file

@ -1,15 +1,15 @@
package alisolarflare.minigames.freeforall.commands;
package alisolarflare.minigames.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.freeforall.data.SpawnSet;
import alisolarflare.minigames.data.SpawnSet;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetFFAS extends TBMCCommandBase{
public class SetColourSpawn extends TBMCCommandBase{
private SpawnSet spawnSet;
public SetFFAS(SpawnSet spawnSet){
public SetColourSpawn(SpawnSet spawnSet){
this.spawnSet = spawnSet;
}
@Override
@ -66,11 +66,6 @@ public class SetFFAS extends TBMCCommandBase{
return false;
}
@Override
public String GetCommandPath() {
// TODO Auto-generated method stub
return "setFFAS";
}
@Override
public String[] GetHelpText(String arg0) {
// TODO Auto-generated method stub
return null;

View file

@ -1,4 +1,4 @@
package alisolarflare.minigames.freeforall.data;
package alisolarflare.minigames.data;
import org.bukkit.Location;

View file

@ -0,0 +1,11 @@
package alisolarflare.minigames.entities;
import org.bukkit.entity.Player;
public class Fighter {
public Player player;
public String colour;
public Fighter(Player player, String colour){
this.colour = colour;
}
}

View file

@ -1,24 +0,0 @@
package alisolarflare.minigames.freeforall;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.minigames.freeforall.commands.SetFFAS;
import alisolarflare.minigames.freeforall.data.SpawnSet;
public class FreeForAllModule extends Module{
public SpawnSet spawnSet;
private int GameState;
@Override
public void register(JavaPlugin plugin) {
this.spawnSet = new SpawnSet();
registerCommand(plugin, new SetFFAS(spawnSet));
}
public int getGameState() {return GameState;}
public void setGameState(int gameState) {GameState = gameState;}
}

View file

@ -1,8 +0,0 @@
package alisolarflare.minigames.freeforall.data;
public class Data {
public SpawnSet spawnset;
public Data(){
spawnset = new SpawnSet();
}
}

View file

@ -1,17 +0,0 @@
package alisolarflare.minigames.freeforall.entities;
import org.bukkit.entity.Player;
public class Fighter {
public Player player;
public String colour;
public Fighter(Player player){
this.player = player;
}
public Fighter(Player player, String colour){
this.colour = colour;
}
public String ToString(){
return player.toString() +": " + colour.toString();
}
}

View file

@ -1,20 +0,0 @@
package alisolarflare.minigames.lobby;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.minigames.lobby.commands.ButtonFight;
import alisolarflare.minigames.lobby.commands.ButtonLeave;
import alisolarflare.minigames.lobby.commands.ListFighters;
public class LobbyModule extends Module{
public List<String> fighters;
public void register(JavaPlugin plugin){
registerCommand(plugin, new ButtonFight(this));
registerCommand(plugin, new ButtonLeave(this));
registerCommand(plugin, new ListFighters(this));
}
}

View file

@ -1,51 +0,0 @@
package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonFight extends TBMCCommandBase {
private LobbyModule lobby;
public ButtonFight(LobbyModule lobby) {
this.lobby = lobby;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
Player player = (Player) sender;
player.sendMessage(player.toString());
String name = player.getName();
if (lobby.fighters.contains(name)) {
player.sendMessage("You are already in the button fight!");
return false;
}
lobby.fighters.add(name);
if (lobby.fighters.contains(name)) {
player.sendMessage("You have joined the fighters category!");
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,48 +0,0 @@
package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonLeave extends TBMCCommandBase {
private LobbyModule lobby;
public ButtonLeave(LobbyModule lobby) {
this.lobby = lobby;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
Player player = (Player) sender;
String name = player.getName();
if (!(lobby.fighters.contains(name))) {
player.sendMessage("You are not fighting!");
return false;
}
lobby.fighters.remove(name);
if (!(lobby.fighters.contains(name))) {
player.sendMessage("You have left the fighters category!");
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,34 +0,0 @@
package alisolarflare.townylearn;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.townylearn.commands.Cbgm0;
import alisolarflare.townylearn.commands.Cbgm1;
import alisolarflare.townylearn.commands.SetDickmode;
public class MainPlugin extends JavaPlugin{
public boolean dickmode;
public void onEnable(){
registerCommands();
registerEvents();
}
public void registerCommands(){
getCommand("cbgm1").setExecutor(new Cbgm1());
getCommand("cbgm0").setExecutor(new Cbgm0());
getCommand("setdickmode").setExecutor(new SetDickmode(this));
}
public void registerEvents(){
PlotChangeListener plotChangeListener = new PlotChangeListener(this);
getServer().getPluginManager().registerEvents(plotChangeListener, this);
}
public void setDickmode(boolean YES){
dickmode = YES;
this.getConfig().set("dickmode", YES);
}
public boolean getDickmode(){
boolean dickmode = this.getConfig().getBoolean("dickmode");
this.dickmode = dickmode;
return dickmode;
}
}

View file

@ -1,23 +0,0 @@
package alisolarflare.townylearn.commands;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Cbgm0 implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL);
return false;
}
}

View file

@ -1,53 +0,0 @@
package alisolarflare.townylearn.commands;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.*;
public class Cbgm1 implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.sendMessage("§cYou aren't standing in a town or some other error occured.");
player.sendMessage("§cTownBlock is null.");
return false;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.sendMessage("§cYou aren't standing in a town or some other error occured.");
player.sendMessage("§cTownBlock's town is not registered.");
return false;
}
if (town == null) {
player.sendMessage("§cERROR: The town you're standing in is Null.");
return false;
}
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE);
return true;
}
}
player.sendMessage("Sorry, you're not part of this town");
return false;
}
}

View file

@ -1,37 +0,0 @@
package alisolarflare.townylearn.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import alisolarflare.townylearn.MainPlugin;
public class SetDickmode implements CommandExecutor{
private MainPlugin plugin;
public SetDickmode(MainPlugin plugin){
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){
if(args[0] == null){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!");
plugin.setDickmode(true);
return true;
}
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!");
plugin.setDickmode(false);
return true;
}
return false;
}
return false;
}
}

View file

@ -1,17 +1,19 @@
package alisolarflare.events.uhc;
package alisolarflare.uhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.events.uhc.commands.AddToUHC;
import alisolarflare.events.uhc.commands.StartMatch;
import alisolarflare.events.uhc.memory.MatchState;
import alisolarflare.events.uhc.memory.UHCMatch;
import alisolarflare.uhc.commands.AddToUHC;
import alisolarflare.uhc.commands.StartMatch;
import alisolarflare.uhc.memory.MatchState;
import alisolarflare.uhc.memory.UHCMatch;
public class UHCModule extends Module {
public UHCMatch match;
public void register(JavaPlugin plugin) {
if (plugin.getConfig().contains("UHCMatchState")){
match = new UHCMatch(plugin.getConfig(), MatchState.valueOf(plugin.getConfig().getString("UHCMatchState")));
}else{

View file

@ -1,9 +1,9 @@
package alisolarflare.events.uhc.commands;
package alisolarflare.uhc.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.events.uhc.memory.UHCMatch;
import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
/**

View file

@ -1,8 +1,8 @@
package alisolarflare.events.uhc.commands;
package alisolarflare.uhc.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.events.uhc.memory.UHCMatch;
import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
public class StartMatch extends TBMCCommandBase {

View file

@ -1,4 +1,4 @@
package alisolarflare.events.uhc.listeners;
package alisolarflare.uhc.listeners;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

View file

@ -1,4 +1,4 @@
package alisolarflare.events.uhc.listeners;
package alisolarflare.uhc.listeners;
import org.bukkit.scheduler.BukkitRunnable;

View file

@ -1,4 +1,4 @@
package alisolarflare.events.uhc.memory;
package alisolarflare.uhc.memory;
public enum MatchState {
IDLE, WAITING, SETUP, INTRO, PEACE, TENSION, POWER, END

View file

@ -1,4 +1,4 @@
package alisolarflare.events.uhc.memory;
package alisolarflare.uhc.memory;
import java.util.ArrayList;
import java.util.List;