Skip to content
Permalink
Browse files

A great big steaming pile of commit!

  • Loading branch information...
JonnyD committed Jul 18, 2012
1 parent a7b288b commit 9651077e98a135c240eb7cf41a6a1d040fc3bd43
Showing with 3,079 additions and 619 deletions.
  1. +5 −1 .classpath
  2. +2 −0 .settings/org.eclipse.core.resources.prefs
  3. +61 −17 plugin.yml
  4. +162 −84 src/com/untamedears/citadel/Citadel.java
  5. +64 −0 src/com/untamedears/citadel/ConfigManager.java
  6. +122 −0 src/com/untamedears/citadel/GroupManager.java
  7. +120 −0 src/com/untamedears/citadel/GroupStorage.java
  8. +90 −0 src/com/untamedears/citadel/MemberManager.java
  9. +30 −0 src/com/untamedears/citadel/MemberStorage.java
  10. +48 −0 src/com/untamedears/citadel/PersonalGroupManager.java
  11. +30 −0 src/com/untamedears/citadel/PersonalGroupStorage.java
  12. +1 −1 src/com/untamedears/citadel/PlacementMode.java
  13. +56 −0 src/com/untamedears/citadel/ReinforcementManager.java
  14. +51 −0 src/com/untamedears/citadel/ReinforcementStorage.java
  15. +81 −23 src/com/untamedears/citadel/Utility.java
  16. +6 −7 src/com/untamedears/citadel/access/AccessDelegate.java
  17. +4 −2 src/com/untamedears/citadel/access/ChestAccessDelegate.java
  18. +0 −109 src/com/untamedears/citadel/command/ChangePlacementMode.java
  19. +30 −0 src/com/untamedears/citadel/command/Command.java
  20. +77 −0 src/com/untamedears/citadel/command/CommandHandler.java
  21. +0 −29 src/com/untamedears/citadel/command/Help.java
  22. +0 −69 src/com/untamedears/citadel/command/ListMaterials.java
  23. +0 −40 src/com/untamedears/citadel/command/ListMembers.java
  24. +0 −41 src/com/untamedears/citadel/command/ModifyFaction.java
  25. +71 −31 src/com/untamedears/citadel/command/PlayerCommand.java
  26. +0 −27 src/com/untamedears/citadel/command/ToggleBypass.java
  27. +0 −32 src/com/untamedears/citadel/command/ViewCurrentVersion.java
  28. +78 −0 src/com/untamedears/citadel/command/commands/AddModCommand.java
  29. +83 −0 src/com/untamedears/citadel/command/commands/AllowCommand.java
  30. +35 −0 src/com/untamedears/citadel/command/commands/BypassCommand.java
  31. +50 −0 src/com/untamedears/citadel/command/commands/CreateCommand.java
  32. +63 −0 src/com/untamedears/citadel/command/commands/DeleteCommand.java
  33. +55 −0 src/com/untamedears/citadel/command/commands/DisallowCommand.java
  34. +50 −0 src/com/untamedears/citadel/command/commands/FortifyCommand.java
  35. +54 −0 src/com/untamedears/citadel/command/commands/GroupCommand.java
  36. +90 −0 src/com/untamedears/citadel/command/commands/GroupsCommand.java
  37. +21 −0 src/com/untamedears/citadel/command/commands/HelpCommand.java
  38. +39 −0 src/com/untamedears/citadel/command/commands/InfoCommand.java
  39. +70 −0 src/com/untamedears/citadel/command/commands/JoinCommand.java
  40. +66 −0 src/com/untamedears/citadel/command/commands/LeaveCommand.java
  41. +42 −0 src/com/untamedears/citadel/command/commands/MaterialsCommand.java
  42. +89 −0 src/com/untamedears/citadel/command/commands/MembersCommand.java
  43. +85 −0 src/com/untamedears/citadel/command/commands/ModeratorsCommand.java
  44. +30 −0 src/com/untamedears/citadel/command/commands/NonReinforceableCommand.java
  45. +37 −0 src/com/untamedears/citadel/command/commands/OffCommand.java
  46. +52 −0 src/com/untamedears/citadel/command/commands/PasswordCommand.java
  47. +35 −0 src/com/untamedears/citadel/command/commands/PrivateCommand.java
  48. +33 −0 src/com/untamedears/citadel/command/commands/PublicCommand.java
  49. +41 −0 src/com/untamedears/citadel/command/commands/ReinforceCommand.java
  50. +54 −0 src/com/untamedears/citadel/command/commands/RemoveModCommand.java
  51. +35 −0 src/com/untamedears/citadel/command/commands/SecurableCommand.java
  52. +36 −0 src/com/untamedears/citadel/command/commands/StatsCommand.java
  53. +78 −0 src/com/untamedears/citadel/command/commands/TransferCommand.java
  54. +28 −0 src/com/untamedears/citadel/command/commands/VersionCommand.java
  55. +159 −16 src/com/untamedears/citadel/dao/CitadelDao.java
  56. +44 −9 src/com/untamedears/citadel/entity/Faction.java
  57. +86 −0 src/com/untamedears/citadel/entity/Member.java
  58. +55 −0 src/com/untamedears/citadel/entity/Moderator.java
  59. +58 −0 src/com/untamedears/citadel/entity/PersonalGroup.java
  60. +42 −15 src/com/untamedears/citadel/entity/Reinforcement.java
  61. +3 −2 src/com/untamedears/citadel/entity/ReinforcementKey.java
  62. +3 −3 src/com/untamedears/citadel/entity/ReinforcementMaterial.java
  63. +27 −22 src/com/untamedears/citadel/listener/EntityListener.java
  64. +58 −36 src/com/untamedears/citadel/listener/PlayerListener.java
  65. +4 −3 src/com/untamedears/citadel/task/BlockFlasher.java
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="D:/code/ancap_mods/bukkit.jar"/>
<classpathentry kind="lib" path="C:/Users/Jonny/Desktop/Workspace/Minecraft/CraftBukkit/craftbukkit.jar">
<attributes>
<attribute name="javadoc_location" value="http://jd.bukkit.org/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//src/com/untamedears/citadel/Citadel.java=UTF-8
@@ -1,14 +1,14 @@
name: Citadel
main: com.untamedears.citadel.Citadel
version: 1.2
version: 2.0
description: Reinforce your structures!
author: cxschx, chrisrico, jonnyd
author: chrisrico, jonnyd (aka Gu3rr1lla)
database: false
commands:
ctmaterials:
aliases: ctm
aliases: ctmat
description: List the possible reinforcement materials, their strengths, and requirements.
usage: /ctmaterials (or /ctm)
usage: /ctmaterials (or /ctmat)
ctsecurable:
aliases: cts
description: Other than containers and doors, lists the blocks which are securable.
@@ -38,29 +38,73 @@ commands:
description: Toggles bypassing your own reinforcements to break blocks normally.
usage: /ctbypass (or /ctb)
ctpublic:
aliases: ctpu
description: The next door/container you interact with will become publicly secured.
usage: /ctpublic
usage: /ctpublic (or /ctpu)
ctprivate:
aliases: ctpr
description: The next door/container you interact with will become privately secured.
usage: /ctprivate
usage: /ctprivate (or /ctpr)
ctgroup:
aliases: ctg
description: The next door/container you interact with will become secured to your group.
usage: /ctgroup
ctlist:
aliases: ctl
usage: /ctgroup (or /ctg) <group-name>
ctcreate:
aliases: ctc
description: Creates a group.
usage: /ctcreate (or /ctc) <group-name>
ctdelete:
aliases: ctdel
description: Deletes a group.
usage: /ctdelete (or /ctdel) <group-name>
ctgroups:
aliases: ctgs
description: Lists your groups.
usage: /ctgroups (or /ctgs)
ctmembers:
aliases: ctm
description: Lists the players in your group.
usage: /ctlist (or /ctl)
usage: /ctmembers (or /ctm) <group-name>
ctallow:
aliases: cta
description: Adds the specified player to your group.
usage: /ctallow (or /cta) <player name>
usage: /ctallow (or /cta) <group-name> <player-name>
ctdisallow:
aliases: ctd
description: Removes the specified player from your group.
usage: /ctdisallow (or /ctd) <player name>
ctremovereinforcements:
description: Removes all reinforcements from the Citadel database.
usage: /ctremovereinforcements
usage: /ctdisallow (or /ctd) <group-name> <player-name>
ctversion:
description: Displays plugin version
usage: /ctversion
aliases: ctv
description: Displays plugin version.
usage: /ctversion (or /ctv)
ctstats:
description: Displays stats.
usage: /ctstats
ctleave:
aliases: ctl
description: Leave a group.
usage: /ctleave (or /ctl)
ctjoin:
aliases: ctj
description: Joins a group.
usage: /ctjoin (or /ctj) <group-name> <password>
ctpassword:
aliases: ctpw
description: Sets a groups password.
usage: /ctpassword (or /ctpw) <group-name> <password>
cttransfer:
aliases: ctt
description: Transfers a group to another player.
usage: /cttransfer (or /ctt) <group-name> <player-name>
ctaddmod:
aliases: ctam
description: Adds a player as moderator to a group.
usage: /ctaddmod (or /ctam) <group-name> <player-name>
ctremovemod:
aliases: ctrm
description: Removes a player as moderator from a group.
usage: /ctremovemod (or /ctrm) <group-name> <player-name>
ctmoderators:
aliases: ctmods
description: Displays moderators of a group.
usage: /ctmoderators (or /ctmods) <group-name>
@@ -1,110 +1,188 @@
package com.untamedears.citadel;

import com.untamedears.citadel.command.*;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import com.untamedears.citadel.command.CommandHandler;
import com.untamedears.citadel.command.commands.AddModCommand;
import com.untamedears.citadel.command.commands.AllowCommand;
import com.untamedears.citadel.command.commands.BypassCommand;
import com.untamedears.citadel.command.commands.CreateCommand;
import com.untamedears.citadel.command.commands.DeleteCommand;
import com.untamedears.citadel.command.commands.DisallowCommand;
import com.untamedears.citadel.command.commands.FortifyCommand;
import com.untamedears.citadel.command.commands.GroupCommand;
import com.untamedears.citadel.command.commands.GroupsCommand;
import com.untamedears.citadel.command.commands.InfoCommand;
import com.untamedears.citadel.command.commands.JoinCommand;
import com.untamedears.citadel.command.commands.LeaveCommand;
import com.untamedears.citadel.command.commands.MaterialsCommand;
import com.untamedears.citadel.command.commands.MembersCommand;
import com.untamedears.citadel.command.commands.ModeratorsCommand;
import com.untamedears.citadel.command.commands.NonReinforceableCommand;
import com.untamedears.citadel.command.commands.OffCommand;
import com.untamedears.citadel.command.commands.PasswordCommand;
import com.untamedears.citadel.command.commands.PrivateCommand;
import com.untamedears.citadel.command.commands.PublicCommand;
import com.untamedears.citadel.command.commands.ReinforceCommand;
import com.untamedears.citadel.command.commands.RemoveModCommand;
import com.untamedears.citadel.command.commands.SecurableCommand;
import com.untamedears.citadel.command.commands.StatsCommand;
import com.untamedears.citadel.command.commands.TransferCommand;
import com.untamedears.citadel.command.commands.VersionCommand;
import com.untamedears.citadel.dao.CitadelDao;
import com.untamedears.citadel.entity.*;
import com.untamedears.citadel.entity.Faction;
import com.untamedears.citadel.entity.FactionMember;
import com.untamedears.citadel.entity.Member;
import com.untamedears.citadel.entity.Moderator;
import com.untamedears.citadel.entity.PersonalGroup;
import com.untamedears.citadel.entity.Reinforcement;
import com.untamedears.citadel.entity.ReinforcementKey;
import com.untamedears.citadel.listener.BlockListener;
import com.untamedears.citadel.listener.EntityListener;
import com.untamedears.citadel.listener.PlayerListener;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.logging.Logger;

public class Citadel extends JavaPlugin {
private static Citadel instance;
public static Citadel getInstance() {
return instance;
}
/**
* User: JonnyD
* Date: 07/18/12
* Time: 11:57 PM
*/
public class Citadel extends JavaPlugin {
private static final Logger log = Logger.getLogger("Citadel");
private static final CommandHandler commandHandler = new CommandHandler();
private static final ReinforcementManager reinforcementManager = new ReinforcementManager();
private static final GroupManager groupManager = new GroupManager();
private static final PersonalGroupManager personalGroupManager = new PersonalGroupManager();
private static final MemberManager memberManager = new MemberManager();
private static final ConfigManager configManager = new ConfigManager();
private static CitadelDao dao;
private static Citadel plugin;

public CitadelDao dao;
public Logger log;
public int flashLength;
private boolean verboseLogging;
public double redstoneDistance;
public double pistonRedstoneDistance;
public long autoModeReset;
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
return commandHandler.dispatch(sender, label, args);
}

public void onEnable() {
Citadel.instance = this;

reloadConfig();
log = this.getLogger();

getConfig().options().copyDefaults(true);
flashLength = getConfig().getInt("general.flashLength");
autoModeReset = getConfig().getInt("general.autoModeReset");
verboseLogging = getConfig().getBoolean("general.verboseLogging");
redstoneDistance = getConfig().getDouble("general.redstoneDistance");
for (Object obj : getConfig().getList("materials")) {
LinkedHashMap map = (LinkedHashMap) obj;
ReinforcementMaterial.put(new ReinforcementMaterial(map));
}
for (String name : getConfig().getStringList("additionalSecurable")) {
Material material = Material.matchMaterial(name);
if (material == null) {
log.warning("Invalid additionalSecurable material " + name);
} else {
Reinforcement.SECURABLE.add(material.getId());
}
}
for (String name : getConfig().getStringList("nonReinforceable")) {
Material material = Material.matchMaterial(name);
if (material == null) {
log.warning("Invalid nonReinforceable material " + name);
} else {
Reinforcement.NON_REINFORCEABLE.add(material.getId());
}
}
saveConfig();

plugin = this;
dao = new CitadelDao(this);
setUpStorage();
registerCommands();
registerEvents();
configManager.load();
for(Player player : getServer().getOnlinePlayers()){
memberManager.addOnlinePlayer(player);
}
log.info("[Citadel] Citadel is now enabled.");
}

//getCommand("cthelp").setExecutor(new Help(this));
getCommand("ctmaterials").setExecutor(new ListMaterials(this));
getCommand("ctsecurable").setExecutor(new ListMaterials(this));
getCommand("ctnonreinforceable").setExecutor(new ListMaterials(this));
getCommand("ctreinforce").setExecutor(new ChangePlacementMode(this));
getCommand("ctfortify").setExecutor(new ChangePlacementMode(this));
getCommand("ctinfo").setExecutor(new ChangePlacementMode(this));
getCommand("ctoff").setExecutor(new ChangePlacementMode(this));
getCommand("ctpublic").setExecutor(new ChangePlacementMode(this));
getCommand("ctprivate").setExecutor(new ChangePlacementMode(this));
getCommand("ctgroup").setExecutor(new ChangePlacementMode(this));
getCommand("ctbypass").setExecutor(new ToggleBypass(this));
getCommand("ctlist").setExecutor(new ListMembers(this));
getCommand("ctallow").setExecutor(new ModifyFaction(this));
getCommand("ctdisallow").setExecutor(new ModifyFaction(this));
getCommand("ctversion").setExecutor(new ViewCurrentVersion(this));

getServer().getPluginManager().registerEvents(new BlockListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
getServer().getPluginManager().registerEvents(new EntityListener(this), this);

log.info("Citadel is now enabled. ( •_•)>�■-■ ( �■_■)");
public void onDisable() {
log.info("[Citadel] Citadel is now disabled.");
}

public void setUpStorage(){
GroupStorage groupStorage = new GroupStorage(dao);
groupManager.setStorage(groupStorage);

PersonalGroupStorage personalGroupStorage = new PersonalGroupStorage(dao);
personalGroupManager.setStorage(personalGroupStorage);

MemberStorage memberStorage = new MemberStorage(dao);
memberManager.setStorage(memberStorage);

ReinforcementStorage reinforcementStorage = new ReinforcementStorage(dao);
reinforcementManager.setStorage(reinforcementStorage);
}

public void registerCommands(){
commandHandler.addCommand(new AddModCommand());
commandHandler.addCommand(new AllowCommand());
commandHandler.addCommand(new BypassCommand());
commandHandler.addCommand(new CreateCommand());
commandHandler.addCommand(new DeleteCommand());
commandHandler.addCommand(new DisallowCommand());
commandHandler.addCommand(new FortifyCommand());
commandHandler.addCommand(new GroupCommand());
commandHandler.addCommand(new GroupsCommand());
//commandHandler.addCommand(new Help())
commandHandler.addCommand(new InfoCommand());
commandHandler.addCommand(new JoinCommand());
commandHandler.addCommand(new LeaveCommand());
commandHandler.addCommand(new MaterialsCommand());
commandHandler.addCommand(new MembersCommand());
commandHandler.addCommand(new ModeratorsCommand());
commandHandler.addCommand(new NonReinforceableCommand());
commandHandler.addCommand(new OffCommand());
commandHandler.addCommand(new PasswordCommand());
commandHandler.addCommand(new PrivateCommand());
commandHandler.addCommand(new PublicCommand());
commandHandler.addCommand(new ReinforceCommand());
commandHandler.addCommand(new RemoveModCommand());
commandHandler.addCommand(new SecurableCommand());
commandHandler.addCommand(new StatsCommand());
commandHandler.addCommand(new TransferCommand());
commandHandler.addCommand(new VersionCommand());
}

public void registerEvents(){
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new BlockListener(), this);
pm.registerEvents(new PlayerListener(), this);
pm.registerEvents(new EntityListener(), this);
}

@Override
public List<Class<?>> getDatabaseClasses() {
ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(Faction.class);
classes.add(FactionMember.class);
classes.add(Member.class);
classes.add(Reinforcement.class);
classes.add(ReinforcementKey.class);
classes.add(FactionMember.class);
classes.add(PersonalGroup.class);
classes.add(Moderator.class);
return classes;
}

public void onDisable() {
Citadel.instance = null;

log.info("Citadel is now disabled. (╯ •_•)╯ 彡┻�┻");

public static void info(String message){
log.info("[Citadel] " + message);
}

public static void severe(String message){
log.severe("[Citadel] " + message);
}

public static void warning(String message){
log.warning("[Citadel] " + message);
}

public static GroupManager getGroupManager(){
return groupManager;
}

public static PersonalGroupManager getPersonalGroupManager(){
return personalGroupManager;
}

public static MemberManager getMemberManager(){
return memberManager;
}

public static ReinforcementManager getReinforcementManager(){
return reinforcementManager;
}

public static ConfigManager getConfigManager(){
return configManager;
}

public void logVerbose(String messageFormat, Object... args) {
if (verboseLogging)
log.info(String.format(messageFormat, args));
public static Citadel getPlugin(){
return plugin;
}
}

0 comments on commit 9651077

Please sign in to comment.
You can’t perform that action at this time.