├── .gitignore ├── .travis.yml ├── Essentials ├── pom.xml ├── src │ ├── book.txt │ ├── com │ │ └── earth2me │ │ │ └── essentials │ │ │ ├── AlternativeCommandsHandler.java │ │ │ ├── Backup.java │ │ │ ├── ChargeException.java │ │ │ ├── CommandSource.java │ │ │ ├── Console.java │ │ │ ├── Enchantments.java │ │ │ ├── Essentials.java │ │ │ ├── EssentialsBlockListener.java │ │ │ ├── EssentialsConf.java │ │ │ ├── EssentialsEntityListener.java │ │ │ ├── EssentialsPlayerListener.java │ │ │ ├── EssentialsPluginListener.java │ │ │ ├── EssentialsTimer.java │ │ │ ├── EssentialsUpgrade.java │ │ │ ├── EssentialsUserConf.java │ │ │ ├── ExecuteTimer.java │ │ │ ├── I18n.java │ │ │ ├── IConf.java │ │ │ ├── IEssentials.java │ │ │ ├── IEssentialsModule.java │ │ │ ├── IReplyTo.java │ │ │ ├── ISettings.java │ │ │ ├── ITarget.java │ │ │ ├── IUser.java │ │ │ ├── ItemDb.java │ │ │ ├── Jails.java │ │ │ ├── Kit.java │ │ │ ├── LocationTarget.java │ │ │ ├── ManagedFile.java │ │ │ ├── MetaItemStack.java │ │ │ ├── Mob.java │ │ │ ├── MobData.java │ │ │ ├── OfflinePlayer.java │ │ │ ├── PlayerExtension.java │ │ │ ├── PlayerList.java │ │ │ ├── PlayerTarget.java │ │ │ ├── Potions.java │ │ │ ├── Settings.java │ │ │ ├── SpawnMob.java │ │ │ ├── TNTExplodeListener.java │ │ │ ├── Teleport.java │ │ │ ├── TimedTeleport.java │ │ │ ├── Trade.java │ │ │ ├── UUIDMap.java │ │ │ ├── User.java │ │ │ ├── UserData.java │ │ │ ├── UserMap.java │ │ │ ├── Warps.java │ │ │ ├── Worth.java │ │ │ ├── api │ │ │ ├── Economy.java │ │ │ ├── II18n.java │ │ │ ├── IItemDb.java │ │ │ ├── IJails.java │ │ │ ├── IReload.java │ │ │ ├── ITeleport.java │ │ │ ├── IWarps.java │ │ │ ├── InvalidNameException.java │ │ │ ├── InvalidWorldException.java │ │ │ ├── NoLoanPermittedException.java │ │ │ └── UserDoesNotExistException.java │ │ │ ├── commands │ │ │ ├── Commandafk.java │ │ │ ├── Commandantioch.java │ │ │ ├── Commandback.java │ │ │ ├── Commandbackup.java │ │ │ ├── Commandbalance.java │ │ │ ├── Commandbalancetop.java │ │ │ ├── Commandban.java │ │ │ ├── Commandbanip.java │ │ │ ├── Commandbigtree.java │ │ │ ├── Commandbook.java │ │ │ ├── Commandbreak.java │ │ │ ├── Commandbroadcast.java │ │ │ ├── Commandburn.java │ │ │ ├── Commandclearinventory.java │ │ │ ├── Commandcompass.java │ │ │ ├── Commandcondense.java │ │ │ ├── Commandcustomtext.java │ │ │ ├── Commanddelhome.java │ │ │ ├── Commanddeljail.java │ │ │ ├── Commanddelwarp.java │ │ │ ├── Commanddepth.java │ │ │ ├── Commandeco.java │ │ │ ├── Commandenchant.java │ │ │ ├── Commandenderchest.java │ │ │ ├── Commandessentials.java │ │ │ ├── Commandexp.java │ │ │ ├── Commandext.java │ │ │ ├── Commandfeed.java │ │ │ ├── Commandfireball.java │ │ │ ├── Commandfirework.java │ │ │ ├── Commandfly.java │ │ │ ├── Commandgamemode.java │ │ │ ├── Commandgc.java │ │ │ ├── Commandgetpos.java │ │ │ ├── Commandgive.java │ │ │ ├── Commandgod.java │ │ │ ├── Commandhat.java │ │ │ ├── Commandheal.java │ │ │ ├── Commandhelp.java │ │ │ ├── Commandhelpop.java │ │ │ ├── Commandhome.java │ │ │ ├── Commandignore.java │ │ │ ├── Commandinfo.java │ │ │ ├── Commandinvsee.java │ │ │ ├── Commanditem.java │ │ │ ├── Commanditemdb.java │ │ │ ├── Commandjails.java │ │ │ ├── Commandjump.java │ │ │ ├── Commandkick.java │ │ │ ├── Commandkickall.java │ │ │ ├── Commandkill.java │ │ │ ├── Commandkit.java │ │ │ ├── Commandkittycannon.java │ │ │ ├── Commandlightning.java │ │ │ ├── Commandlist.java │ │ │ ├── Commandmail.java │ │ │ ├── Commandme.java │ │ │ ├── Commandmore.java │ │ │ ├── Commandmotd.java │ │ │ ├── Commandmsg.java │ │ │ ├── Commandmute.java │ │ │ ├── Commandnear.java │ │ │ ├── Commandnick.java │ │ │ ├── Commandnuke.java │ │ │ ├── Commandpay.java │ │ │ ├── Commandping.java │ │ │ ├── Commandpotion.java │ │ │ ├── Commandpowertool.java │ │ │ ├── Commandpowertooltoggle.java │ │ │ ├── Commandptime.java │ │ │ ├── Commandpweather.java │ │ │ ├── Commandr.java │ │ │ ├── Commandrealname.java │ │ │ ├── Commandrecipe.java │ │ │ ├── Commandremove.java │ │ │ ├── Commandrepair.java │ │ │ ├── Commandrules.java │ │ │ ├── Commandseen.java │ │ │ ├── Commandsell.java │ │ │ ├── Commandsethome.java │ │ │ ├── Commandsetjail.java │ │ │ ├── Commandsetwarp.java │ │ │ ├── Commandsetworth.java │ │ │ ├── Commandskull.java │ │ │ ├── Commandsocialspy.java │ │ │ ├── Commandspawner.java │ │ │ ├── Commandspawnmob.java │ │ │ ├── Commandspeed.java │ │ │ ├── Commandsudo.java │ │ │ ├── Commandsuicide.java │ │ │ ├── Commandtempban.java │ │ │ ├── Commandthunder.java │ │ │ ├── Commandtime.java │ │ │ ├── Commandtogglejail.java │ │ │ ├── Commandtop.java │ │ │ ├── Commandtp.java │ │ │ ├── Commandtpa.java │ │ │ ├── Commandtpaall.java │ │ │ ├── Commandtpaccept.java │ │ │ ├── Commandtpahere.java │ │ │ ├── Commandtpall.java │ │ │ ├── Commandtpdeny.java │ │ │ ├── Commandtphere.java │ │ │ ├── Commandtpo.java │ │ │ ├── Commandtpohere.java │ │ │ ├── Commandtppos.java │ │ │ ├── Commandtptoggle.java │ │ │ ├── Commandtree.java │ │ │ ├── Commandunban.java │ │ │ ├── Commandunbanip.java │ │ │ ├── Commandunlimited.java │ │ │ ├── Commandvanish.java │ │ │ ├── Commandwarp.java │ │ │ ├── Commandweather.java │ │ │ ├── Commandwhois.java │ │ │ ├── Commandworkbench.java │ │ │ ├── Commandworld.java │ │ │ ├── Commandworth.java │ │ │ ├── EssentialsCommand.java │ │ │ ├── EssentialsLoopCommand.java │ │ │ ├── EssentialsToggleCommand.java │ │ │ ├── IEssentialsCommand.java │ │ │ ├── NoChargeException.java │ │ │ ├── NotEnoughArgumentsException.java │ │ │ ├── PlayerExemptException.java │ │ │ ├── PlayerNotFoundException.java │ │ │ ├── QuietAbortException.java │ │ │ └── WarpNotFoundException.java │ │ │ ├── craftbukkit │ │ │ ├── BanLookup.java │ │ │ ├── FakeWorld.java │ │ │ ├── InventoryWorkaround.java │ │ │ └── SetExpFix.java │ │ │ ├── metrics │ │ │ ├── Metrics.java │ │ │ ├── MetricsListener.java │ │ │ └── MetricsStarter.java │ │ │ ├── perm │ │ │ ├── BPermissions2Handler.java │ │ │ ├── ConfigPermissionsHandler.java │ │ │ ├── GroupManagerHandler.java │ │ │ ├── IPermissionsHandler.java │ │ │ ├── NullPermissionsHandler.java │ │ │ ├── PermissionsBukkitHandler.java │ │ │ ├── PermissionsExHandler.java │ │ │ ├── PermissionsHandler.java │ │ │ ├── PrivilegesHandler.java │ │ │ ├── SimplyPermsHandler.java │ │ │ ├── SuperpermsHandler.java │ │ │ └── ZPermissionsHandler.java │ │ │ ├── register │ │ │ └── payment │ │ │ │ ├── Method.java │ │ │ │ ├── Methods.java │ │ │ │ └── methods │ │ │ │ ├── BOSE7.java │ │ │ │ ├── MCUR.java │ │ │ │ ├── VaultEco.java │ │ │ │ ├── iCo5.java │ │ │ │ └── iCo6.java │ │ │ ├── settings │ │ │ ├── Jails.java │ │ │ └── Spawns.java │ │ │ ├── signs │ │ │ ├── EssentialsSign.java │ │ │ ├── SignBalance.java │ │ │ ├── SignBlockListener.java │ │ │ ├── SignBuy.java │ │ │ ├── SignDisposal.java │ │ │ ├── SignEnchant.java │ │ │ ├── SignEntityListener.java │ │ │ ├── SignException.java │ │ │ ├── SignFree.java │ │ │ ├── SignGameMode.java │ │ │ ├── SignHeal.java │ │ │ ├── SignInfo.java │ │ │ ├── SignKit.java │ │ │ ├── SignMail.java │ │ │ ├── SignPlayerListener.java │ │ │ ├── SignProtection.java │ │ │ ├── SignRepair.java │ │ │ ├── SignSell.java │ │ │ ├── SignSpawnmob.java │ │ │ ├── SignTime.java │ │ │ ├── SignTrade.java │ │ │ ├── SignWarp.java │ │ │ ├── SignWeather.java │ │ │ └── Signs.java │ │ │ ├── storage │ │ │ ├── AbstractDelayedYamlFileReader.java │ │ │ ├── AbstractDelayedYamlFileWriter.java │ │ │ ├── AsyncStorageObjectHolder.java │ │ │ ├── BukkitConstructor.java │ │ │ ├── Comment.java │ │ │ ├── EnchantmentLevel.java │ │ │ ├── IStorageObjectHolder.java │ │ │ ├── IStorageReader.java │ │ │ ├── IStorageWriter.java │ │ │ ├── ListType.java │ │ │ ├── MapKeyType.java │ │ │ ├── MapValueType.java │ │ │ ├── ObjectLoadException.java │ │ │ ├── StorageObject.java │ │ │ ├── YamlStorageReader.java │ │ │ └── YamlStorageWriter.java │ │ │ ├── textreader │ │ │ ├── BookInput.java │ │ │ ├── BookPager.java │ │ │ ├── HelpInput.java │ │ │ ├── IText.java │ │ │ ├── KeywordReplacer.java │ │ │ ├── SimpleTextInput.java │ │ │ ├── SimpleTextPager.java │ │ │ ├── TextInput.java │ │ │ └── TextPager.java │ │ │ └── utils │ │ │ ├── DateUtil.java │ │ │ ├── DescParseTickFormat.java │ │ │ ├── FormatUtil.java │ │ │ ├── LocationUtil.java │ │ │ ├── NumberUtil.java │ │ │ └── StringUtil.java │ ├── config.yml │ ├── custom.txt │ ├── info.txt │ ├── items.csv │ ├── messages.properties │ ├── messages_cs.properties │ ├── messages_da.properties │ ├── messages_de.properties │ ├── messages_en.properties │ ├── messages_es.properties │ ├── messages_et.properties │ ├── messages_fi.properties │ ├── messages_fr.properties │ ├── messages_hu.properties │ ├── messages_it.properties │ ├── messages_ko.properties │ ├── messages_lt.properties │ ├── messages_nl.properties │ ├── messages_pl.properties │ ├── messages_pt.properties │ ├── messages_pt_BR.properties │ ├── messages_ro.properties │ ├── messages_ru.properties │ ├── messages_sv.properties │ ├── messages_tr.properties │ ├── messages_zh.properties │ ├── messages_zh_HK.properties │ ├── messages_zh_TW.properties │ ├── motd.txt │ ├── net │ │ └── ess3 │ │ │ └── api │ │ │ ├── Economy.java │ │ │ ├── IEssentials.java │ │ │ ├── II18n.java │ │ │ ├── IItemDb.java │ │ │ ├── IJails.java │ │ │ ├── IReload.java │ │ │ ├── ISettings.java │ │ │ ├── ITeleport.java │ │ │ ├── IUser.java │ │ │ ├── IWarps.java │ │ │ ├── InvalidNameException.java │ │ │ ├── InvalidWorldException.java │ │ │ ├── MaxMoneyException.java │ │ │ ├── NoLoanPermittedException.java │ │ │ ├── UserDoesNotExistException.java │ │ │ └── events │ │ │ ├── AfkStatusChangeEvent.java │ │ │ ├── GodStatusChangeEvent.java │ │ │ ├── IgnoreStatusChangeEvent.java │ │ │ ├── JailStatusChangeEvent.java │ │ │ ├── LocalChatSpyEvent.java │ │ │ ├── MuteStatusChangeEvent.java │ │ │ ├── NickChangeEvent.java │ │ │ ├── SignBreakEvent.java │ │ │ ├── SignCreateEvent.java │ │ │ ├── SignEvent.java │ │ │ ├── SignInteractEvent.java │ │ │ ├── StateChangeEvent.java │ │ │ ├── StatusChangeEvent.java │ │ │ └── UserBalanceUpdateEvent.java │ ├── plugin.yml │ ├── rules.txt │ └── worth.yml └── test │ └── com │ └── earth2me │ └── essentials │ ├── EconomyTest.java │ ├── FakeServer.java │ ├── StorageTest.java │ ├── ToggleTest.java │ ├── UserTest.java │ └── UtilTest.java ├── EssentialsAntiBuild ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── antibuild │ │ ├── AntiBuildConfig.java │ │ ├── EssentialsAntiBuild.java │ │ ├── EssentialsAntiBuildListener.java │ │ ├── EssentialsConnect.java │ │ └── IAntiBuild.java │ └── plugin.yml ├── EssentialsChat ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── chat │ │ ├── ChatStore.java │ │ ├── EssentialsChat.java │ │ ├── EssentialsChatPlayer.java │ │ ├── EssentialsChatPlayerListenerHighest.java │ │ ├── EssentialsChatPlayerListenerLowest.java │ │ └── EssentialsChatPlayerListenerNormal.java │ └── plugin.yml ├── EssentialsGeoIP ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── geoip │ │ ├── EssentialsGeoIP.java │ │ └── EssentialsGeoIPPlayerListener.java │ ├── config.yml │ └── plugin.yml ├── EssentialsGroupManager ├── .classpath ├── .project ├── build.xml ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── Changelog.txt │ ├── config.yml │ ├── globalgroups.yml │ ├── groups.yml │ ├── org │ └── anjocaido │ │ └── groupmanager │ │ ├── GMConfiguration.java │ │ ├── GlobalGroups.java │ │ ├── GroupManager.java │ │ ├── Tasks │ │ └── BukkitPermsUpdateTask.java │ │ ├── data │ │ ├── DataUnit.java │ │ ├── Group.java │ │ ├── GroupVariables.java │ │ ├── User.java │ │ ├── UserVariables.java │ │ └── Variables.java │ │ ├── dataholder │ │ ├── GroupsDataHolder.java │ │ ├── OverloadedWorldHolder.java │ │ ├── UsersDataHolder.java │ │ ├── WorldDataHolder.java │ │ └── worlds │ │ │ └── WorldsHolder.java │ │ ├── events │ │ ├── GMGroupEvent.java │ │ ├── GMSystemEvent.java │ │ ├── GMUserEvent.java │ │ ├── GMWorldListener.java │ │ └── GroupManagerEventHandler.java │ │ ├── permissions │ │ ├── AnjoPermissionsHandler.java │ │ ├── BukkitPermissions.java │ │ └── PermissionsReaderInterface.java │ │ └── utils │ │ ├── GMLoggerHandler.java │ │ ├── GroupManagerPermissions.java │ │ ├── PermissionCheckResult.java │ │ ├── StringPermissionComparator.java │ │ └── Tasks.java │ ├── plugin.yml │ └── users.yml ├── EssentialsProtect ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── protect │ │ ├── EmergencyListener.java │ │ ├── EssentialsConnect.java │ │ ├── EssentialsProtect.java │ │ ├── EssentialsProtectBlockListener.java │ │ ├── EssentialsProtectEntityListener.java │ │ ├── EssentialsProtectWeatherListener.java │ │ ├── IProtect.java │ │ └── ProtectConfig.java │ └── plugin.yml ├── EssentialsSpawn ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── spawn │ │ ├── Commandsetspawn.java │ │ ├── Commandspawn.java │ │ ├── EssentialsSpawn.java │ │ ├── EssentialsSpawnPlayerListener.java │ │ ├── IEssentialsSpawn.java │ │ └── SpawnStorage.java │ └── plugin.yml ├── EssentialsXMPP ├── pom.xml └── src │ ├── com │ └── earth2me │ │ └── essentials │ │ └── xmpp │ │ ├── Commandsetxmpp.java │ │ ├── Commandxmpp.java │ │ ├── Commandxmppspy.java │ │ ├── EssentialsXMPP.java │ │ ├── EssentialsXMPPPlayerListener.java │ │ ├── IEssentialsXMPP.java │ │ ├── UserManager.java │ │ └── XMPPManager.java │ ├── config.yml │ └── plugin.yml ├── LICENSE ├── README.markdown ├── WebPush ├── apikey.php ├── index.php ├── nbproject │ ├── private │ │ └── private.properties │ └── project.properties ├── simple_html_dom.php └── upload.php ├── examples ├── bpermissions.yml ├── permissionsbukkit.yml └── permissionsex.yml ├── groupmanager-pom.xml ├── lib ├── BOSEconomy.jar ├── MultiCurrency.jar ├── PermissionsBukkit.jar ├── PermissionsEx.jar ├── Privileges.jar ├── SimplyPerms.jar ├── bukkit.jar ├── iCo5.jar ├── iCo6.jar └── zPermissions.jar ├── nbactions.xml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /BuildAll/nbproject/private/ 3 | /EssentialsProtect/nbproject/private/ 4 | /EssentialsChat/nbproject/private/ 5 | /EssentialsGroupBridge/nbproject/private/ 6 | /EssentialsGeoIP/nbproject/private/ 7 | /EssentialsSpawn/nbproject/private/ 8 | /EssentialsXMPP/nbproject/private/ 9 | /EssentialsGroupManager/nbproject/private/ 10 | /BuildAll/build/ 11 | /EssentialsGroupBridge/dist/ 12 | /EssentialsGroupBridge/build/ 13 | /EssentialsGeoIP/dist/ 14 | /EssentialsGeoIP/build/ 15 | /EssentialsGroupManager/build/ 16 | /EssentialsGroupManager/dist/ 17 | /BuildAll/dist/ 18 | /EssentialsChat/build/ 19 | /EssentialsChat/dist/ 20 | /EssentialsSpawn/build/ 21 | /EssentialsSpawn/dist/ 22 | /EssentialsXMPP/dist/ 23 | /EssentialsXMPP/build/ 24 | /EssentialsProtect/dist/ 25 | /EssentialsProtect/build/ 26 | /EssentialsPermissionsCommands/nbproject/private/ 27 | /EssentialsPermissionsCommands/build/ 28 | /EssentialsPermissionsCommands/dist/ 29 | /Essentials/nbproject/private/ 30 | /Essentials/dist/ 31 | /Essentials/build/ 32 | /YamlAnnotations/ 33 | /EssentialsUpdate/nbproject/private/ 34 | /EssentialsRelease/ 35 | /EssentialsUpdate/dist/ 36 | /EssentialsUpdate/build/ 37 | /WebPush/apikey.php 38 | /WebPush/nbproject/private 39 | /EssentialsGroupManager/bin 40 | /EssentialsGroupManager/.externalToolBuilders 41 | /EssentialsAntiBuild/nbproject/private/ 42 | /EssentialsAntiBuild/dist/ 43 | /EssentialsAntiBuild/build/ 44 | /jars 45 | /out 46 | .idea/ 47 | *.iml 48 | target/ 49 | dependency-reduced-pom.xml 50 | /Essentials/config.yml 51 | /Essentials/userdata/testplayer1.yml 52 | /Essentials/usermap.csv 53 | /Essentials/userdata 54 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk7 4 | - openjdk7 5 | - openjdk6 6 | script: mvn compile test 7 | install: true 8 | notifications: 9 | irc: 10 | channels: 11 | - "irc.esper.net#lain" 12 | on_success: change 13 | on_failure: always 14 | email: 15 | recipients: 16 | - "khobbits@ess3.net" 17 | on_success: change 18 | on_failure: always -------------------------------------------------------------------------------- /Essentials/src/book.txt: -------------------------------------------------------------------------------- 1 | This is the book file. 2 | 3 | This file format works similar to the info.txt, motd.txt and rules.txt 4 | 5 | Place content in here that you would like to be used by books ingame. 6 | 7 | You can use this content by using the book:
meta option in kits or item spawning. 8 | 9 | #Colors 10 | Minecraft colors: 11 | &0 &&0 &1 &&1 &2 &&2 &3 &&3 12 | &4 &&4 &5 &&5 &6 &&6 &7 &&7 13 | &8 &&8 &9 &&9 &a &&a &b &&b 14 | &c &&c &d &&d &e &&e &f &&f 15 | &0 16 | &&k &kMagic&r &&l &lBold 17 | &&m &mStrike&r &&n &nUline 18 | &&o &oItalic&r &&r &rReset -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/ChargeException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | 4 | public class ChargeException extends Exception 5 | { 6 | public ChargeException(final String message) 7 | { 8 | super(message); 9 | } 10 | 11 | public ChargeException(final String message, final Throwable throwable) 12 | { 13 | super(message, throwable); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/CommandSource.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | 6 | 7 | public class CommandSource implements IReplyTo 8 | { 9 | private CommandSource replyTo = null; 10 | protected CommandSender sender; 11 | 12 | public CommandSource(final CommandSender base) 13 | { 14 | this.sender = base; 15 | } 16 | 17 | public final CommandSender getSender() 18 | { 19 | return sender; 20 | } 21 | 22 | public final Player getPlayer() 23 | { 24 | if (sender instanceof Player) 25 | { 26 | return (Player)sender; 27 | } 28 | return null; 29 | } 30 | 31 | public final boolean isPlayer() 32 | { 33 | return (sender instanceof Player); 34 | } 35 | 36 | public final CommandSender setSender(final CommandSender base) 37 | { 38 | return this.sender = base; 39 | } 40 | 41 | 42 | public void sendMessage(String message) 43 | { 44 | if (!message.isEmpty()) 45 | { 46 | sender.sendMessage(message); 47 | } 48 | } 49 | 50 | @Override 51 | public void setReplyTo(final CommandSource user) 52 | { 53 | replyTo = user; 54 | } 55 | 56 | @Override 57 | public CommandSource getReplyTo() 58 | { 59 | return replyTo; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/Console.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import org.bukkit.Server; 4 | import org.bukkit.command.CommandSender; 5 | 6 | 7 | public final class Console implements IReplyTo 8 | { 9 | private static final Console instance = new Console(); 10 | private CommandSource replyTo; 11 | public final static String NAME = "Console"; 12 | 13 | private Console() 14 | { 15 | } 16 | 17 | public static CommandSender getCommandSender(Server server) throws Exception 18 | { 19 | return server.getConsoleSender(); 20 | } 21 | 22 | @Override 23 | public void setReplyTo(CommandSource user) 24 | { 25 | replyTo = user; 26 | } 27 | 28 | @Override 29 | public CommandSource getReplyTo() 30 | { 31 | return replyTo; 32 | } 33 | 34 | public static Console getConsoleReplyTo() 35 | { 36 | return instance; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/IConf.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | public interface IConf 4 | { 5 | public void reloadConfig(); 6 | } 7 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/IEssentialsModule.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | 4 | public interface IEssentialsModule 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/IReplyTo.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | public interface IReplyTo 4 | { 5 | /** 6 | * Sets the user to reply to 7 | * @param user 8 | */ 9 | public void setReplyTo(CommandSource user); 10 | 11 | /** 12 | * Gets the user the sender should reply to 13 | * @return 14 | */ 15 | public CommandSource getReplyTo(); 16 | } 17 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/ITarget.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import org.bukkit.Location; 4 | 5 | 6 | public interface ITarget 7 | { 8 | public Location getLocation(); 9 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/LocationTarget.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import org.bukkit.Location; 4 | 5 | 6 | public class LocationTarget implements ITarget 7 | { 8 | private final Location location; 9 | 10 | LocationTarget(Location location) 11 | { 12 | this.location = location; 13 | } 14 | 15 | @Override 16 | public Location getLocation() 17 | { 18 | return location; 19 | } 20 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/PlayerExtension.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import lombok.Delegate; 4 | import org.bukkit.Location; 5 | import org.bukkit.Server; 6 | import org.bukkit.World; 7 | import org.bukkit.command.CommandSender; 8 | import org.bukkit.configuration.serialization.ConfigurationSerializable; 9 | import org.bukkit.entity.Entity; 10 | import org.bukkit.entity.HumanEntity; 11 | import org.bukkit.entity.LivingEntity; 12 | import org.bukkit.entity.Player; 13 | import org.bukkit.permissions.Permissible; 14 | import org.bukkit.permissions.ServerOperator; 15 | 16 | 17 | public class PlayerExtension 18 | { 19 | protected Player base; 20 | 21 | public PlayerExtension(final Player base) 22 | { 23 | this.base = base; 24 | } 25 | 26 | public final Player getBase() 27 | { 28 | return base; 29 | } 30 | 31 | public final Player setBase(final Player base) 32 | { 33 | return this.base = base; 34 | } 35 | 36 | public Server getServer() 37 | { 38 | return base.getServer(); 39 | } 40 | 41 | public World getWorld() { 42 | return base.getWorld(); 43 | } 44 | 45 | public Location getLocation() { 46 | return base.getLocation(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/PlayerTarget.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | 7 | 8 | public class PlayerTarget implements ITarget 9 | { 10 | private final String name; 11 | 12 | public PlayerTarget(Player entity) 13 | { 14 | this.name = entity.getName(); 15 | } 16 | 17 | @Override 18 | public Location getLocation() 19 | { 20 | return Bukkit.getServer().getPlayerExact(name).getLocation(); 21 | } 22 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/TNTExplodeListener.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import net.ess3.api.IEssentials; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.entity.EntityExplodeEvent; 9 | 10 | 11 | public class TNTExplodeListener implements Listener, Runnable 12 | { 13 | private final transient IEssentials ess; 14 | private transient boolean enabled = false; 15 | private transient int timer = -1; 16 | 17 | public TNTExplodeListener(final IEssentials ess) 18 | { 19 | super(); 20 | this.ess = ess; 21 | } 22 | 23 | public void enable() 24 | { 25 | if (!enabled) 26 | { 27 | enabled = true; 28 | timer = ess.scheduleSyncDelayedTask(this, 200); 29 | return; 30 | } 31 | if (timer != -1) 32 | { 33 | ess.getScheduler().cancelTask(timer); 34 | timer = ess.scheduleSyncDelayedTask(this, 200); 35 | } 36 | } 37 | 38 | @EventHandler(priority = EventPriority.LOW) 39 | public void onEntityExplode(final EntityExplodeEvent event) 40 | { 41 | if (!enabled) 42 | { 43 | return; 44 | } 45 | if (event.getEntity() instanceof LivingEntity) 46 | { 47 | return; 48 | } 49 | if (event.blockList().size() < 1) 50 | { 51 | return; 52 | } 53 | event.setCancelled(true); 54 | event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); 55 | } 56 | 57 | @Override 58 | public void run() 59 | { 60 | enabled = false; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/II18n.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | import java.util.Locale; 4 | 5 | 6 | public interface II18n 7 | { 8 | /** 9 | * Gets the current locale setting 10 | * @return the current locale, if not set it will return the default locale 11 | */ 12 | Locale getCurrentLocale(); 13 | } 14 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/IItemDb.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earth2me.essentials.api; 3 | 4 | import com.earth2me.essentials.User; 5 | import java.util.List; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | 9 | public interface IItemDb 10 | { 11 | ItemStack get(final String name, final int quantity) throws Exception; 12 | 13 | ItemStack get(final String name) throws Exception; 14 | 15 | public String names(ItemStack item); 16 | 17 | public String name(ItemStack item); 18 | 19 | List getMatching(User user, String[] args) throws Exception; 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/IJails.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | import java.util.Collection; 4 | import net.ess3.api.IUser; 5 | import org.bukkit.Location; 6 | 7 | 8 | public interface IJails extends IReload 9 | { 10 | /** 11 | * Gets the location of the jail with the given name 12 | * @param jailName The name of the jail 13 | * @return the location of the jail 14 | * @throws Exception if the jail does not exist 15 | */ 16 | Location getJail(String jailName) throws Exception; 17 | 18 | /** 19 | * Gets a list of jails by names 20 | * @return a list of jails, if there are none the list will be empty 21 | * @throws Exception 22 | */ 23 | Collection getList() throws Exception; 24 | 25 | /** 26 | * Gets the number of jails 27 | * @return the size of the list of jails 28 | */ 29 | int getCount(); 30 | 31 | /** 32 | * Remove the jail with the given name 33 | * @param jail the jail to remove 34 | * @throws Exception if the jail does not exist 35 | */ 36 | void removeJail(String jail) throws Exception; 37 | 38 | /** 39 | * Attempts to send the given user to the given jail 40 | * @param user the user to send to jail 41 | * @param jail the jail to send the user to 42 | * @throws Exception if the user is offline or jail does not exist 43 | */ 44 | void sendToJail(IUser user, String jail) throws Exception; 45 | 46 | /** 47 | * Set a new jail with the given name and location 48 | * @param jailName the name of the jail being set 49 | * @param loc the location of the jail being set 50 | * @throws Exception 51 | */ 52 | void setJail(String jailName, Location loc) throws Exception; 53 | } 54 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/IReload.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | 4 | public interface IReload 5 | { 6 | void onReload(); 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/IWarps.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | import com.earth2me.essentials.IConf; 4 | import com.earth2me.essentials.commands.WarpNotFoundException; 5 | import java.io.File; 6 | import java.util.Collection; 7 | import org.bukkit.Location; 8 | 9 | 10 | public interface IWarps extends IConf 11 | { 12 | /** 13 | * Get a warp by name 14 | * 15 | * @param warp - Warp name 16 | * @return - Location the warp is set to 17 | * @throws WarpNotFoundException When the warp is not found 18 | * @throws InvalidWorldException When the world the warp is in is not found 19 | */ 20 | Location getWarp(String warp) throws WarpNotFoundException, net.ess3.api.InvalidWorldException; 21 | 22 | /** 23 | * Gets a list of warps 24 | * 25 | * @return - A {@link Collection} of warps 26 | */ 27 | Collection getList(); 28 | 29 | /** 30 | * Gets the number of warps 31 | * 32 | * @return the size of the list of warps 33 | */ 34 | int getCount(); 35 | 36 | /** 37 | * Delete a warp from the warp DB 38 | * 39 | * @param name - Name of warp 40 | * @throws Exception 41 | */ 42 | void removeWarp(String name) throws Exception; 43 | 44 | /** 45 | * Set a warp 46 | * 47 | * @param name - Name of warp 48 | * @param loc - Location of warp 49 | * @throws Exception 50 | */ 51 | void setWarp(String name, Location loc) throws Exception; 52 | 53 | /** 54 | * Check to see if the file is empty 55 | * 56 | * @return 57 | */ 58 | boolean isEmpty(); 59 | 60 | /** 61 | * Get a warp file note: this is not yet implemented, as 3.x uses different storage methods 62 | * 63 | * @param name - name of file 64 | * @return - an instance of the file 65 | * @throws InvalidNameException - When the file is not found 66 | */ 67 | File getWarpFile(String name) throws net.ess3.api.InvalidNameException; 68 | } 69 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/InvalidNameException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | 4 | public class InvalidNameException extends Exception 5 | { 6 | /** 7 | * NOTE: This is not implemented yet, just here for future 3.x api support 8 | * Allow serialization of the InvalidNameException exception 9 | */ 10 | private static final long serialVersionUID = 1485321420293663139L; 11 | 12 | public InvalidNameException(Throwable thrwbl) 13 | { 14 | super(thrwbl); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class InvalidWorldException extends Exception 7 | { 8 | private final String world; 9 | 10 | public InvalidWorldException(final String world) 11 | { 12 | super(tl("invalidWorld")); 13 | this.world = world; 14 | } 15 | 16 | public String getWorld() 17 | { 18 | return this.world; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | 4 | public class NoLoanPermittedException extends net.ess3.api.NoLoanPermittedException 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/api/UserDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class UserDoesNotExistException extends Exception 7 | { 8 | public UserDoesNotExistException(String name) 9 | { 10 | super(tl("userDoesNotExist", name)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandafk.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandafk extends EssentialsCommand 10 | { 11 | public Commandafk() 12 | { 13 | super("afk"); 14 | } 15 | 16 | @Override 17 | public void run(Server server, User user, String commandLabel, String[] args) throws Exception 18 | { 19 | if (args.length > 0 && user.isAuthorized("essentials.afk.others")) 20 | { 21 | User afkUser = getPlayer(server, user, args, 0); 22 | toggleAfk(afkUser); 23 | } 24 | else 25 | { 26 | toggleAfk(user); 27 | } 28 | } 29 | 30 | @Override 31 | public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception 32 | { 33 | if (args.length > 0) 34 | { 35 | User afkUser = getPlayer(server, args, 0, true, false); 36 | toggleAfk(afkUser); 37 | } 38 | else 39 | { 40 | throw new NotEnoughArgumentsException(); 41 | } 42 | } 43 | 44 | private void toggleAfk(User user) 45 | { 46 | user.setDisplayNick(); 47 | String msg = ""; 48 | if (!user.toggleAfk()) 49 | { 50 | //user.sendMessage(_("markedAsNotAway")); 51 | if (!user.isHidden()) 52 | { 53 | msg = tl("userIsNotAway", user.getDisplayName()); 54 | } 55 | user.updateActivity(false); 56 | } 57 | else 58 | { 59 | //user.sendMessage(_("markedAsAway")); 60 | if (!user.isHidden()) 61 | { 62 | msg = tl("userIsAway", user.getDisplayName()); 63 | } 64 | } 65 | if (!msg.isEmpty()) 66 | { 67 | ess.broadcastMessage(user, msg); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandantioch.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.User; 4 | import com.earth2me.essentials.utils.LocationUtil; 5 | import org.bukkit.Location; 6 | import org.bukkit.Server; 7 | import org.bukkit.entity.TNTPrimed; 8 | 9 | // This command has a in theme message that only shows if you supply a parameter #EasterEgg 10 | public class Commandantioch extends EssentialsCommand 11 | { 12 | public Commandantioch() 13 | { 14 | super("antioch"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | if (args.length > 0) 21 | { 22 | ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,"); 23 | ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it."); 24 | } 25 | 26 | final Location loc = LocationUtil.getTarget(user.getBase()); 27 | loc.getWorld().spawn(loc, TNTPrimed.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandback.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandback extends EssentialsCommand 10 | { 11 | public Commandback() 12 | { 13 | super("back"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (user.getLastLocation() == null) 20 | { 21 | throw new Exception(tl("noLocationFound")); 22 | } 23 | if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions() 24 | && !user.isAuthorized("essentials.worlds." + user.getLastLocation().getWorld().getName())) 25 | { 26 | throw new Exception(tl("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName())); 27 | } 28 | final Trade charge = new Trade(this.getName(), ess); 29 | charge.isAffordableFor(user); 30 | user.getTeleport().back(charge); 31 | throw new NoChargeException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandbackup.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.Backup; 4 | import com.earth2me.essentials.CommandSource; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandbackup extends EssentialsCommand 10 | { 11 | public Commandbackup() 12 | { 13 | super("backup"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 18 | { 19 | final Backup backup = ess.getBackup(); 20 | if (backup == null) 21 | { 22 | throw new Exception(tl("backupDisabled")); 23 | } 24 | final String command = ess.getSettings().getBackupCommand(); 25 | if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command)) 26 | { 27 | throw new Exception(tl("backupDisabled")); 28 | } 29 | backup.run(); 30 | sender.sendMessage(tl("backupStarted")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandbalance.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.NumberUtil; 7 | import java.math.BigDecimal; 8 | import org.bukkit.Server; 9 | 10 | 11 | public class Commandbalance extends EssentialsCommand 12 | { 13 | public Commandbalance() 14 | { 15 | super("balance"); 16 | } 17 | 18 | @Override 19 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 20 | { 21 | if (args.length < 1) 22 | { 23 | throw new NotEnoughArgumentsException(); 24 | } 25 | 26 | User target = getPlayer(server, args, 0, true, true); 27 | sender.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess))); 28 | } 29 | 30 | @Override 31 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 32 | { 33 | if (args.length == 1 && user.isAuthorized("essentials.balance.others")) 34 | { 35 | final User target = getPlayer(server, args, 0, true, true); 36 | final BigDecimal bal = target.getMoney(); 37 | user.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(bal, ess))); 38 | } 39 | else if (args.length < 2) 40 | { 41 | final BigDecimal bal = user.getMoney(); 42 | user.sendMessage(tl("balance", NumberUtil.displayCurrency(bal, ess))); 43 | } 44 | else 45 | { 46 | throw new NotEnoughArgumentsException(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.utils.LocationUtil; 6 | import org.bukkit.Location; 7 | import org.bukkit.Server; 8 | import org.bukkit.TreeType; 9 | 10 | 11 | public class Commandbigtree extends EssentialsCommand 12 | { 13 | public Commandbigtree() 14 | { 15 | super("bigtree"); 16 | } 17 | 18 | @Override 19 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 20 | { 21 | TreeType tree; 22 | if (args.length > 0 && args[0].equalsIgnoreCase("redwood")) 23 | { 24 | tree = TreeType.TALL_REDWOOD; 25 | } 26 | else if (args.length > 0 && args[0].equalsIgnoreCase("tree")) 27 | { 28 | tree = TreeType.BIG_TREE; 29 | } 30 | else if (args.length > 0 && args[0].equalsIgnoreCase("jungle")) 31 | { 32 | tree = TreeType.JUNGLE; 33 | } 34 | else 35 | { 36 | throw new NotEnoughArgumentsException(); 37 | } 38 | 39 | final Location loc = LocationUtil.getTarget(user.getBase()); 40 | final Location safeLocation = LocationUtil.getSafeDestination(loc); 41 | final boolean success = user.getWorld().generateTree(safeLocation, tree); 42 | if (success) 43 | { 44 | user.sendMessage(tl("bigTreeSuccess")); 45 | } 46 | else 47 | { 48 | throw new Exception(tl("bigTreeFailure")); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandbreak.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Material; 6 | import org.bukkit.Server; 7 | import org.bukkit.block.Block; 8 | import org.bukkit.event.block.BlockBreakEvent; 9 | 10 | 11 | public class Commandbreak extends EssentialsCommand 12 | { 13 | public Commandbreak() 14 | { 15 | super("break"); 16 | } 17 | 18 | //TODO: Switch to use util class 19 | @Override 20 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | final Block block = user.getBase().getTargetBlock(null, 20); 23 | if (block == null) 24 | { 25 | throw new NoChargeException(); 26 | } 27 | if (block.getType() == Material.AIR) 28 | { 29 | throw new NoChargeException(); 30 | } 31 | if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock")) 32 | { 33 | throw new Exception(tl("noBreakBedrock")); 34 | } 35 | //final List list = (List)block.getDrops(); 36 | //final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list); 37 | final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase()); 38 | server.getPluginManager().callEvent(event); 39 | if (event.isCancelled()) 40 | { 41 | throw new NoChargeException(); 42 | } 43 | else 44 | { 45 | block.setType(Material.AIR); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.FormatUtil; 7 | import org.bukkit.Server; 8 | 9 | 10 | public class Commandbroadcast extends EssentialsCommand 11 | { 12 | public Commandbroadcast() 13 | { 14 | super("broadcast"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | sendBroadcast(user.getDisplayName(), args); 21 | } 22 | 23 | @Override 24 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 25 | { 26 | sendBroadcast(sender.getSender().getName(), args); 27 | } 28 | 29 | private void sendBroadcast(final String name, final String[] args) throws NotEnoughArgumentsException 30 | { 31 | if (args.length < 1) 32 | { 33 | throw new NotEnoughArgumentsException(); 34 | } 35 | 36 | ess.broadcastMessage(tl("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0)).replace("\\n", "\n"), name)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandburn.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandburn extends EssentialsCommand 10 | { 11 | public Commandburn() 12 | { 13 | super("burn"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 2) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | 24 | if (args[0].trim().length() < 2) 25 | { 26 | throw new NotEnoughArgumentsException(); 27 | } 28 | 29 | User user = getPlayer(server, sender, args, 0); 30 | user.getBase().setFireTicks(Integer.parseInt(args[1]) * 20); 31 | sender.sendMessage(tl("burnMsg", user.getDisplayName(), Integer.parseInt(args[1]))); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandcompass.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandcompass extends EssentialsCommand 9 | { 10 | public Commandcompass() 11 | { 12 | super("compass"); 13 | } 14 | 15 | @Override 16 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | final int bearing = (int)(user.getLocation().getYaw() + 180 + 360) % 360; 19 | String dir; 20 | if (bearing < 23) 21 | { 22 | dir = "N"; 23 | } 24 | else if (bearing < 68) 25 | { 26 | dir = "NE"; 27 | } 28 | else if (bearing < 113) 29 | { 30 | dir = "E"; 31 | } 32 | else if (bearing < 158) 33 | { 34 | dir = "SE"; 35 | } 36 | else if (bearing < 203) 37 | { 38 | dir = "S"; 39 | } 40 | else if (bearing < 248) 41 | { 42 | dir = "SW"; 43 | } 44 | else if (bearing < 293) 45 | { 46 | dir = "W"; 47 | } 48 | else if (bearing < 338) 49 | { 50 | dir = "NW"; 51 | } 52 | else 53 | { 54 | dir = "N"; 55 | } 56 | user.sendMessage(tl("compassBearing", dir, bearing)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.textreader.IText; 5 | import com.earth2me.essentials.textreader.KeywordReplacer; 6 | import com.earth2me.essentials.textreader.TextInput; 7 | import com.earth2me.essentials.textreader.TextPager; 8 | import com.earth2me.essentials.utils.NumberUtil; 9 | import org.bukkit.Server; 10 | 11 | 12 | public class Commandcustomtext extends EssentialsCommand 13 | { 14 | public Commandcustomtext() 15 | { 16 | super("customtext"); 17 | } 18 | 19 | @Override 20 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (sender.isPlayer()) 23 | { 24 | ess.getUser(sender.getPlayer()).setDisplayNick(); 25 | } 26 | 27 | final IText input = new TextInput(sender, "custom", true, ess); 28 | final IText output = new KeywordReplacer(input, sender, ess); 29 | final TextPager pager = new TextPager(output); 30 | String chapter = commandLabel; 31 | String page; 32 | 33 | if (commandLabel.equalsIgnoreCase("customtext") && args.length > 0 && !NumberUtil.isInt(commandLabel)) 34 | { 35 | chapter = args[0]; 36 | page = args.length > 1 ? args[1] : null; 37 | } 38 | else 39 | { 40 | page = args.length > 0 ? args[0] : null; 41 | } 42 | 43 | pager.showPage(chapter, page, null, sender); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import java.util.Locale; 7 | import org.bukkit.Server; 8 | 9 | 10 | public class Commanddelhome extends EssentialsCommand 11 | { 12 | public Commanddelhome() 13 | { 14 | super("delhome"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final CommandSource sender, final String commandLabel, String[] args) throws Exception 19 | { 20 | if (args.length < 1) 21 | { 22 | throw new NotEnoughArgumentsException(); 23 | } 24 | 25 | User user = ess.getUser(sender.getPlayer()); 26 | String name; 27 | String[] expandedArg; 28 | 29 | //Allowing both formats /sethome khobbits house | /sethome khobbits:house 30 | final String[] nameParts = args[0].split(":"); 31 | if (nameParts[0].length() != args[0].length()) 32 | { 33 | expandedArg = nameParts; 34 | } 35 | else 36 | { 37 | expandedArg = args; 38 | } 39 | 40 | if (expandedArg.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others"))) 41 | { 42 | user = getPlayer(server, expandedArg, 0, true, true); 43 | name = expandedArg[1]; 44 | } 45 | else if (user == null) 46 | { 47 | throw new NotEnoughArgumentsException(); 48 | } 49 | else 50 | { 51 | name = expandedArg[0]; 52 | } 53 | 54 | if (name.equalsIgnoreCase("bed")) 55 | { 56 | throw new Exception(tl("invalidHomeName")); 57 | } 58 | 59 | user.delHome(name.toLowerCase(Locale.ENGLISH)); 60 | sender.sendMessage(tl("deleteHome", name)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commanddeljail extends EssentialsCommand 9 | { 10 | public Commanddeljail() 11 | { 12 | super("deljail"); 13 | } 14 | 15 | @Override 16 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 17 | { 18 | if (args.length < 1) 19 | { 20 | throw new NotEnoughArgumentsException(); 21 | } 22 | 23 | ess.getJails().removeJail(args[0]); 24 | sender.sendMessage(tl("deleteJail", args[0])); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commanddelwarp extends EssentialsCommand 9 | { 10 | public Commanddelwarp() 11 | { 12 | super("delwarp"); 13 | } 14 | 15 | @Override 16 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 17 | { 18 | if (args.length < 1) 19 | { 20 | throw new NotEnoughArgumentsException(); 21 | } 22 | 23 | ess.getWarps().removeWarp(args[0]); 24 | sender.sendMessage(tl("deleteWarp", args[0])); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commanddepth.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commanddepth extends EssentialsCommand 9 | { 10 | public Commanddepth() 11 | { 12 | super("depth"); 13 | } 14 | 15 | @Override 16 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | final int depth = user.getLocation().getBlockY() - 63; 19 | if (depth > 0) 20 | { 21 | user.sendMessage(tl("depthAboveSea", depth)); 22 | } 23 | else if (depth < 0) 24 | { 25 | user.sendMessage(tl("depthBelowSea", (-depth))); 26 | } 27 | else 28 | { 29 | user.sendMessage(tl("depth")); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.User; 4 | import org.bukkit.Server; 5 | 6 | 7 | public class Commandenderchest extends EssentialsCommand 8 | { 9 | public Commandenderchest() 10 | { 11 | super("enderchest"); 12 | } 13 | 14 | @Override 15 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 16 | { 17 | if (args.length > 0 && user.isAuthorized("essentials.enderchest.others")) 18 | { 19 | final User invUser = getPlayer(server, user, args, 0); 20 | user.getBase().closeInventory(); 21 | user.getBase().openInventory(invUser.getBase().getEnderChest()); 22 | user.setEnderSee(true); 23 | } 24 | else 25 | { 26 | user.getBase().closeInventory(); 27 | user.getBase().openInventory(user.getBase().getEnderChest()); 28 | user.setEnderSee(false); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandext.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | import org.bukkit.entity.Player; 8 | 9 | 10 | public class Commandext extends EssentialsLoopCommand 11 | { 12 | public Commandext() 13 | { 14 | super("ext"); 15 | } 16 | 17 | @Override 18 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 19 | { 20 | if (args.length < 1) 21 | { 22 | throw new NotEnoughArgumentsException(); 23 | } 24 | 25 | loopOnlinePlayers(server, sender, true, true, args[0], null); 26 | } 27 | 28 | @Override 29 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 30 | { 31 | if (args.length < 1) 32 | { 33 | extPlayer(user.getBase()); 34 | user.sendMessage(tl("extinguish")); 35 | return; 36 | } 37 | 38 | loopOnlinePlayers(server, user.getSource(), true, true, args[0], null); 39 | } 40 | 41 | @Override 42 | protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) 43 | { 44 | extPlayer(player.getBase()); 45 | sender.sendMessage(tl("extinguishOthers", player.getDisplayName())); 46 | } 47 | 48 | private void extPlayer(final Player player) 49 | { 50 | player.setFireTicks(0); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandfireball.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.User; 4 | import org.bukkit.Server; 5 | import org.bukkit.entity.*; 6 | import org.bukkit.util.Vector; 7 | 8 | 9 | public class Commandfireball extends EssentialsCommand 10 | { 11 | public Commandfireball() 12 | { 13 | super("fireball"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | Class type = Fireball.class; 20 | Projectile projectile; 21 | int speed = 2; 22 | if (args.length > 0) 23 | { 24 | if (args[0].equalsIgnoreCase("small")) 25 | { 26 | type = SmallFireball.class; 27 | } 28 | else if (args[0].equalsIgnoreCase("arrow")) 29 | { 30 | type = Arrow.class; 31 | } 32 | else if (args[0].equalsIgnoreCase("skull")) 33 | { 34 | type = WitherSkull.class; 35 | } 36 | else if (args[0].equalsIgnoreCase("egg")) 37 | { 38 | type = Egg.class; 39 | } 40 | else if(args[0].equalsIgnoreCase("snowball")) 41 | { 42 | type = Snowball.class; 43 | } 44 | else if(args[0].equalsIgnoreCase("expbottle")) 45 | { 46 | type = ThrownExpBottle.class; 47 | } 48 | else if(args[0].equalsIgnoreCase("large")) 49 | { 50 | type = LargeFireball.class; 51 | } 52 | } 53 | final Vector direction = user.getBase().getEyeLocation().getDirection().multiply(speed); 54 | projectile = (Projectile)user.getWorld().spawn(user.getBase().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type); 55 | projectile.setShooter(user.getBase()); 56 | projectile.setVelocity(direction); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Location; 7 | import org.bukkit.Server; 8 | 9 | 10 | public class Commandgetpos extends EssentialsCommand 11 | { 12 | public Commandgetpos() 13 | { 14 | super("getpos"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) 21 | { 22 | final User otherUser = getPlayer(server, user, args, 0); 23 | outputPosition(user.getSource(), otherUser.getLocation(), user.getLocation()); 24 | return; 25 | } 26 | outputPosition(user.getSource(), user.getLocation(), null); 27 | } 28 | 29 | @Override 30 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 31 | { 32 | if (args.length < 1) 33 | { 34 | throw new NotEnoughArgumentsException(); 35 | } 36 | final User user = getPlayer(server, args, 0, true, false); 37 | outputPosition(sender, user.getLocation(), null); 38 | } 39 | 40 | private void outputPosition(final CommandSource sender, final Location coords, final Location distance) 41 | { 42 | sender.sendMessage(tl("currentWorld", coords.getWorld().getName())); 43 | sender.sendMessage(tl("posX", coords.getBlockX())); 44 | sender.sendMessage(tl("posY", coords.getBlockY())); 45 | sender.sendMessage(tl("posZ", coords.getBlockZ())); 46 | sender.sendMessage(tl("posYaw", (coords.getYaw() + 180 + 360) % 360)); 47 | sender.sendMessage(tl("posPitch", coords.getPitch())); 48 | if (distance != null && coords.getWorld().equals(distance.getWorld())) 49 | { 50 | sender.sendMessage(tl("distance", coords.distance(distance))); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandhat.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.craftbukkit.InventoryWorkaround; 6 | import org.bukkit.Material; 7 | import org.bukkit.Server; 8 | import org.bukkit.inventory.ItemStack; 9 | import org.bukkit.inventory.PlayerInventory; 10 | 11 | 12 | public class Commandhat extends EssentialsCommand 13 | { 14 | public Commandhat() 15 | { 16 | super("hat"); 17 | } 18 | 19 | @Override 20 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0"))) 23 | { 24 | final PlayerInventory inv = user.getBase().getInventory(); 25 | final ItemStack head = inv.getHelmet(); 26 | if (head == null || head.getType() == Material.AIR) 27 | { 28 | user.sendMessage(tl("hatEmpty")); 29 | } 30 | else 31 | { 32 | final ItemStack air = new ItemStack(Material.AIR); 33 | inv.setHelmet(air); 34 | InventoryWorkaround.addItems(user.getBase().getInventory(), head); 35 | user.sendMessage(tl("hatRemoved")); 36 | } 37 | } 38 | else 39 | { 40 | if (user.getBase().getItemInHand().getType() != Material.AIR) 41 | { 42 | final ItemStack hand = user.getBase().getItemInHand(); 43 | if (hand.getType().getMaxDurability() == 0) 44 | { 45 | final PlayerInventory inv = user.getBase().getInventory(); 46 | final ItemStack head = inv.getHelmet(); 47 | inv.setHelmet(hand); 48 | inv.setItemInHand(head); 49 | user.sendMessage(tl("hatPlaced")); 50 | } 51 | else 52 | { 53 | user.sendMessage(tl("hatArmor")); 54 | } 55 | } 56 | else 57 | { 58 | user.sendMessage(tl("hatFail")); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandhelp.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.textreader.*; 7 | import com.earth2me.essentials.utils.NumberUtil; 8 | import java.util.Locale; 9 | import org.bukkit.Server; 10 | 11 | 12 | public class Commandhelp extends EssentialsCommand 13 | { 14 | public Commandhelp() 15 | { 16 | super("help"); 17 | } 18 | 19 | @Override 20 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | IText output; 23 | String pageStr = args.length > 0 ? args[0] : null; 24 | String chapterPageStr = args.length > 1 ? args[1] : null; 25 | String command = commandLabel; 26 | final IText input = new TextInput(user.getSource(), "help", false, ess); 27 | 28 | if (input.getLines().isEmpty()) 29 | { 30 | if (NumberUtil.isInt(pageStr) || pageStr == null) 31 | { 32 | output = new HelpInput(user, "", ess); 33 | } 34 | else 35 | { 36 | if (pageStr.length() > 26) 37 | { 38 | pageStr = pageStr.substring(0, 25); 39 | } 40 | output = new HelpInput(user, pageStr.toLowerCase(Locale.ENGLISH), ess); 41 | command = command.concat(" ").concat(pageStr); 42 | pageStr = chapterPageStr; 43 | } 44 | chapterPageStr = null; 45 | } 46 | else 47 | { 48 | user.setDisplayNick(); 49 | output = new KeywordReplacer(input, user.getSource(), ess); 50 | } 51 | final TextPager pager = new TextPager(output); 52 | pager.showPage(pageStr, chapterPageStr, command, user.getSource()); 53 | } 54 | 55 | @Override 56 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 57 | { 58 | sender.sendMessage(tl("helpConsole")); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.Console; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import com.earth2me.essentials.User; 7 | import com.earth2me.essentials.utils.FormatUtil; 8 | import java.util.logging.Level; 9 | import org.bukkit.Server; 10 | 11 | 12 | public class Commandhelpop extends EssentialsCommand 13 | { 14 | public Commandhelpop() 15 | { 16 | super("helpop"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | user.setDisplayNick(); 23 | final String message = sendMessage(server, user.getSource(), user.getDisplayName(), args); 24 | if (!user.isAuthorized("essentials.helpop.receive")) 25 | { 26 | user.sendMessage(message); 27 | } 28 | } 29 | 30 | @Override 31 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 32 | { 33 | sendMessage(server, sender, Console.NAME, args); 34 | } 35 | 36 | private String sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception 37 | { 38 | if (args.length < 1) 39 | { 40 | throw new NotEnoughArgumentsException(); 41 | } 42 | final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0))); 43 | server.getLogger().log(Level.INFO, message); 44 | ess.broadcastMessage("essentials.helpop.receive", message); 45 | return message; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandignore.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandignore extends EssentialsCommand 9 | { 10 | public Commandignore() 11 | { 12 | super("ignore"); 13 | } 14 | 15 | @Override 16 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | if (args.length < 1) 19 | { 20 | StringBuilder sb = new StringBuilder(); 21 | for (String s : user._getIgnoredPlayers()) 22 | { 23 | sb.append(s).append(" "); 24 | } 25 | String ignoredList = sb.toString().trim(); 26 | user.sendMessage(ignoredList.length() > 0 ? tl("ignoredList", ignoredList) : tl("noIgnored")); 27 | } 28 | else 29 | { 30 | User player; 31 | try 32 | { 33 | player = getPlayer(server, args, 0, true, true); 34 | } 35 | catch (PlayerNotFoundException ex) 36 | { 37 | player = ess.getOfflineUser(args[0]); 38 | } 39 | if (player == null) 40 | { 41 | throw new PlayerNotFoundException(); 42 | } 43 | if (player.isIgnoreExempt()) { 44 | user.sendMessage(tl("ignoreExempt")); 45 | } 46 | else if (user.isIgnoredPlayer(player)) 47 | { 48 | user.setIgnoredPlayer(player, false); 49 | user.sendMessage(tl("unignorePlayer", player.getName())); 50 | } 51 | else 52 | { 53 | user.setIgnoredPlayer(player, true); 54 | user.sendMessage(tl("ignorePlayer", player.getName())); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandinfo.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.textreader.IText; 5 | import com.earth2me.essentials.textreader.KeywordReplacer; 6 | import com.earth2me.essentials.textreader.TextInput; 7 | import com.earth2me.essentials.textreader.TextPager; 8 | import org.bukkit.Server; 9 | 10 | 11 | public class Commandinfo extends EssentialsCommand 12 | { 13 | public Commandinfo() 14 | { 15 | super("info"); 16 | } 17 | 18 | @Override 19 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 20 | { 21 | if (sender.isPlayer()) 22 | { 23 | ess.getUser(sender.getPlayer()).setDisplayNick(); 24 | } 25 | 26 | final IText input = new TextInput(sender, "info", true, ess); 27 | final IText output = new KeywordReplacer(input, sender, ess); 28 | final TextPager pager = new TextPager(output); 29 | pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.User; 4 | import org.bukkit.Server; 5 | import org.bukkit.inventory.Inventory; 6 | 7 | 8 | public class Commandinvsee extends EssentialsCommand 9 | { 10 | public Commandinvsee() 11 | { 12 | super("invsee"); 13 | } 14 | 15 | //This method has a hidden param, which if given will display the equip slots. #easteregg 16 | @Override 17 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 1) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | 24 | final User invUser = getPlayer(server, user, args, 0); 25 | Inventory inv; 26 | 27 | if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) 28 | { 29 | inv = server.createInventory(invUser.getBase(), 9, "Equipped"); 30 | inv.setContents(invUser.getBase().getInventory().getArmorContents()); 31 | } 32 | else 33 | { 34 | inv = invUser.getBase().getInventory(); 35 | } 36 | user.getBase().closeInventory(); 37 | user.getBase().openInventory(inv); 38 | user.setInvSee(true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import org.bukkit.Material; 6 | import org.bukkit.Server; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | 10 | public class Commanditemdb extends EssentialsCommand 11 | { 12 | public Commanditemdb() 13 | { 14 | super("itemdb"); 15 | } 16 | 17 | @Override 18 | protected void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception 19 | { 20 | ItemStack itemStack = null; 21 | boolean itemHeld = false; 22 | if (args.length < 1) 23 | { 24 | if (sender.isPlayer()) 25 | { 26 | itemHeld = true; 27 | itemStack = sender.getPlayer().getItemInHand(); 28 | } 29 | if (itemStack == null) 30 | { 31 | throw new NotEnoughArgumentsException(); 32 | } 33 | } 34 | else 35 | { 36 | itemStack = ess.getItemDb().get(args[0]); 37 | } 38 | sender.sendMessage(tl("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()))); 39 | 40 | if (itemHeld && itemStack.getType() != Material.AIR) 41 | { 42 | int maxuses = itemStack.getType().getMaxDurability(); 43 | int durability = ((maxuses + 1) - itemStack.getDurability()); 44 | if (maxuses != 0) 45 | { 46 | sender.sendMessage(tl("durability", Integer.toString(durability))); 47 | } 48 | } 49 | final String itemNameList = ess.getItemDb().names(itemStack); 50 | if (itemNameList != null) 51 | { 52 | sender.sendMessage(tl("itemNames", ess.getItemDb().names(itemStack))); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandjails.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.utils.StringUtil; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandjails extends EssentialsCommand 9 | { 10 | public Commandjails() 11 | { 12 | super("jails"); 13 | } 14 | 15 | @Override 16 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 17 | { 18 | sender.sendMessage("§7" + StringUtil.joinList(" ", ess.getJails().getList())); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandjump.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.LocationUtil; 7 | import org.bukkit.Location; 8 | import org.bukkit.Server; 9 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 10 | 11 | // This method contains an undocumented sub command #EasterEgg 12 | public class Commandjump extends EssentialsCommand 13 | { 14 | public Commandjump() 15 | { 16 | super("jump"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (args.length > 0 && args[0].contains("lock") && user.isAuthorized("essentials.jump.lock")) 23 | { 24 | if (user.isFlyClickJump()) 25 | { 26 | user.setRightClickJump(false); 27 | user.sendMessage("Flying wizard mode disabled"); 28 | } 29 | else 30 | { 31 | user.setRightClickJump(true); 32 | user.sendMessage("Enabling flying wizard mode"); 33 | } 34 | return; 35 | } 36 | 37 | Location loc; 38 | final Location cloc = user.getLocation(); 39 | 40 | try 41 | { 42 | loc = LocationUtil.getTarget(user.getBase()); 43 | loc.setYaw(cloc.getYaw()); 44 | loc.setPitch(cloc.getPitch()); 45 | loc.setY(loc.getY() + 1); 46 | } 47 | catch (NullPointerException ex) 48 | { 49 | throw new Exception(tl("jumpError"), ex); 50 | } 51 | 52 | final Trade charge = new Trade(this.getName(), ess); 53 | charge.isAffordableFor(user); 54 | user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND); 55 | throw new NoChargeException(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandkick.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.Console; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import com.earth2me.essentials.User; 7 | import com.earth2me.essentials.utils.FormatUtil; 8 | import java.util.logging.Level; 9 | import org.bukkit.Server; 10 | 11 | 12 | public class Commandkick extends EssentialsCommand 13 | { 14 | public Commandkick() 15 | { 16 | super("kick"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (args.length < 1) 23 | { 24 | throw new NotEnoughArgumentsException(); 25 | } 26 | 27 | final User target = getPlayer(server, args, 0, true, false); 28 | if (sender.isPlayer()) 29 | { 30 | User user = ess.getUser(sender.getPlayer()); 31 | if (target.isHidden(sender.getPlayer()) && !user.canInteractVanished() && !sender.getPlayer().canSee(target.getBase())) 32 | { 33 | throw new PlayerNotFoundException(); 34 | } 35 | 36 | if (target.isAuthorized("essentials.kick.exempt")) 37 | { 38 | throw new Exception(tl("kickExempt")); 39 | } 40 | } 41 | 42 | String kickReason = args.length > 1 ? getFinalArg(args, 1) : tl("kickDefault"); 43 | kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); 44 | 45 | target.getBase().kickPlayer(kickReason); 46 | final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; 47 | 48 | server.getLogger().log(Level.INFO, tl("playerKicked", senderName, target.getName(), kickReason)); 49 | ess.broadcastMessage("essentials.kick.notify", tl("playerKicked", senderName, target.getName(), kickReason)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandkickall.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.utils.FormatUtil; 6 | import org.bukkit.Server; 7 | import org.bukkit.entity.Player; 8 | 9 | 10 | public class Commandkickall extends EssentialsCommand 11 | { 12 | public Commandkickall() 13 | { 14 | super("kickall"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 19 | { 20 | String kickReason = args.length > 0 ? getFinalArg(args, 0) : tl("kickDefault"); 21 | kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); 22 | 23 | for (Player onlinePlayer : ess.getOnlinePlayers()) 24 | { 25 | if (!sender.isPlayer() || !onlinePlayer.getName().equalsIgnoreCase(sender.getPlayer().getName())) 26 | { 27 | onlinePlayer.kickPlayer(kickReason); 28 | } 29 | } 30 | sender.sendMessage(tl("kickedAll")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandkill.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.event.entity.EntityDamageEvent; 9 | 10 | 11 | public class Commandkill extends EssentialsLoopCommand 12 | { 13 | public Commandkill() 14 | { 15 | super("kill"); 16 | } 17 | 18 | @Override 19 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 20 | { 21 | if (args.length < 1) 22 | { 23 | throw new NotEnoughArgumentsException(); 24 | } 25 | 26 | loopOnlinePlayers(server, sender, true, true, args[0], null); 27 | } 28 | 29 | @Override 30 | protected void updatePlayer(final Server server, final CommandSource sender, final User user, final String[] args) throws PlayerExemptException 31 | { 32 | final Player matchPlayer = user.getBase(); 33 | if (sender.isPlayer() && user.isAuthorized("essentials.kill.exempt") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) 34 | { 35 | throw new PlayerExemptException(tl("killExempt", matchPlayer.getDisplayName())); 36 | } 37 | final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender.isPlayer() && sender.getPlayer().getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); 38 | server.getPluginManager().callEvent(ede); 39 | if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) 40 | { 41 | return; 42 | } 43 | matchPlayer.damage(Short.MAX_VALUE); 44 | 45 | if (matchPlayer.getHealth() > 0) 46 | { 47 | matchPlayer.setHealth(0); 48 | } 49 | 50 | sender.sendMessage(tl("kill", matchPlayer.getDisplayName())); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.Mob; 4 | import com.earth2me.essentials.User; 5 | import java.util.Random; 6 | import org.bukkit.Location; 7 | import org.bukkit.Server; 8 | import org.bukkit.entity.Ocelot; 9 | 10 | // This command is not documented on the wiki #EasterEgg 11 | public class Commandkittycannon extends EssentialsCommand 12 | { 13 | private static final Random random = new Random(); 14 | 15 | public Commandkittycannon() 16 | { 17 | super("kittycannon"); 18 | } 19 | 20 | @Override 21 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 22 | { 23 | final Mob cat = Mob.OCELOT; 24 | final Ocelot ocelot = (Ocelot)cat.spawn(user.getWorld(), server, user.getBase().getEyeLocation()); 25 | if (ocelot == null) 26 | { 27 | return; 28 | } 29 | final int i = random.nextInt(Ocelot.Type.values().length); 30 | ocelot.setCatType(Ocelot.Type.values()[i]); 31 | ocelot.setTamed(true); 32 | ocelot.setBaby(); 33 | ocelot.setVelocity(user.getBase().getEyeLocation().getDirection().multiply(2)); 34 | 35 | class KittyCannonExplodeTask implements Runnable 36 | { 37 | @Override 38 | public void run() 39 | { 40 | final Location loc = ocelot.getLocation(); 41 | ocelot.remove(); 42 | loc.getWorld().createExplosion(loc, 0F); 43 | } 44 | } 45 | ess.scheduleSyncDelayedTask(new KittyCannonExplodeTask(), 20); 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandlightning.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | import org.bukkit.entity.LightningStrike; 8 | 9 | 10 | public class Commandlightning extends EssentialsLoopCommand 11 | { 12 | int power = 5; 13 | 14 | public Commandlightning() 15 | { 16 | super("lightning"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 21 | { 22 | User user; 23 | if (sender.isPlayer()) 24 | { 25 | user = ess.getUser(sender.getPlayer()); 26 | if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others"))) 27 | { 28 | user.getWorld().strikeLightning(user.getBase().getTargetBlock(null, 600).getLocation()); 29 | return; 30 | } 31 | } 32 | 33 | if (args.length > 1) 34 | { 35 | try 36 | { 37 | power = Integer.parseInt(args[1]); 38 | } 39 | catch (NumberFormatException ex) 40 | { 41 | } 42 | } 43 | loopOnlinePlayers(server, sender, true, true, args[0], null); 44 | } 45 | 46 | @Override 47 | protected void updatePlayer(final Server server, final CommandSource sender, final User matchUser, final String[] args) 48 | { 49 | sender.sendMessage(tl("lightningUse", matchUser.getDisplayName())); 50 | final LightningStrike strike = matchUser.getBase().getWorld().strikeLightningEffect(matchUser.getBase().getLocation()); 51 | 52 | if (!matchUser.isGodModeEnabled()) 53 | { 54 | matchUser.getBase().damage(power, strike); 55 | } 56 | if (ess.getSettings().warnOnSmite()) 57 | { 58 | matchUser.sendMessage(tl("lightningSmited")); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandme.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.FormatUtil; 7 | import org.bukkit.Server; 8 | 9 | 10 | public class Commandme extends EssentialsCommand 11 | { 12 | public Commandme() 13 | { 14 | super("me"); 15 | } 16 | 17 | @Override 18 | public void run(Server server, User user, String commandLabel, String[] args) throws Exception 19 | { 20 | if (user.isMuted()) 21 | { 22 | throw new Exception(tl("voiceSilenced")); 23 | } 24 | 25 | if (args.length < 1) 26 | { 27 | throw new NotEnoughArgumentsException(); 28 | } 29 | 30 | String message = getFinalArg(args, 0); 31 | message = FormatUtil.formatMessage(user, "essentials.chat", message); 32 | 33 | user.setDisplayNick(); 34 | ess.broadcastMessage(user, tl("action", user.getDisplayName(), message)); 35 | } 36 | 37 | @Override 38 | public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception 39 | { 40 | if (args.length < 1) 41 | { 42 | throw new NotEnoughArgumentsException(); 43 | } 44 | 45 | String message = getFinalArg(args, 0); 46 | message = FormatUtil.replaceFormat(message); 47 | 48 | ess.getServer().broadcastMessage(tl("action", "@", message)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandmore.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import java.util.Locale; 6 | import org.bukkit.Server; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | 10 | public class Commandmore extends EssentialsCommand 11 | { 12 | public Commandmore() 13 | { 14 | super("more"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | final ItemStack stack = user.getBase().getItemInHand(); 21 | if (stack == null) 22 | { 23 | throw new Exception(tl("cantSpawnItem", "Air")); 24 | } 25 | if (stack.getAmount() >= ((user.isAuthorized("essentials.oversizedstacks")) 26 | ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) 27 | { 28 | throw new Exception(tl("fullStack")); 29 | } 30 | final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); 31 | if (ess.getSettings().permissionBasedItemSpawn() 32 | ? (!user.isAuthorized("essentials.itemspawn.item-all") 33 | && !user.isAuthorized("essentials.itemspawn.item-" + itemname) 34 | && !user.isAuthorized("essentials.itemspawn.item-" + stack.getTypeId())) 35 | : (!user.isAuthorized("essentials.itemspawn.exempt") 36 | && !user.canSpawnItem(stack.getTypeId()))) 37 | { 38 | throw new Exception(tl("cantSpawnItem", itemname)); 39 | } 40 | if (user.isAuthorized("essentials.oversizedstacks")) 41 | { 42 | stack.setAmount(ess.getSettings().getOversizedStackSize()); 43 | } 44 | else 45 | { 46 | stack.setAmount(stack.getMaxStackSize()); 47 | } 48 | user.getBase().updateInventory(); 49 | } 50 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandmotd.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.textreader.IText; 5 | import com.earth2me.essentials.textreader.KeywordReplacer; 6 | import com.earth2me.essentials.textreader.TextInput; 7 | import com.earth2me.essentials.textreader.TextPager; 8 | import org.bukkit.Server; 9 | 10 | 11 | public class Commandmotd extends EssentialsCommand 12 | { 13 | public Commandmotd() 14 | { 15 | super("motd"); 16 | } 17 | 18 | @Override 19 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 20 | { 21 | if (sender.isPlayer()) 22 | { 23 | ess.getUser(sender.getPlayer()).setDisplayNick(); 24 | } 25 | 26 | final IText input = new TextInput(sender, "motd", true, ess); 27 | final IText output = new KeywordReplacer(input, sender, ess); 28 | final TextPager pager = new TextPager(output); 29 | pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandnuke.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import java.util.ArrayList; 6 | import java.util.Collection; 7 | import org.bukkit.Location; 8 | import org.bukkit.Server; 9 | import org.bukkit.World; 10 | import org.bukkit.entity.Player; 11 | import org.bukkit.entity.TNTPrimed; 12 | 13 | 14 | public class Commandnuke extends EssentialsCommand 15 | { 16 | public Commandnuke() 17 | { 18 | super("nuke"); 19 | } 20 | 21 | @Override 22 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException 23 | { 24 | Collection targets; 25 | if (args.length > 0) 26 | { 27 | targets = new ArrayList(); 28 | int pos = 0; 29 | for (String arg : args) 30 | { 31 | targets.add(getPlayer(server, sender, args, pos).getBase()); 32 | pos++; 33 | } 34 | } 35 | else 36 | { 37 | targets = ess.getOnlinePlayers(); 38 | } 39 | ess.getTNTListener().enable(); 40 | for (Player player : targets) 41 | { 42 | if (player == null) 43 | { 44 | continue; 45 | } 46 | player.sendMessage(tl("nuke")); 47 | final Location loc = player.getLocation(); 48 | final World world = loc.getWorld(); 49 | for (int x = -10; x <= 10; x += 5) 50 | { 51 | for (int z = -10; z <= 10; z += 5) 52 | { 53 | final Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z); 54 | final TNTPrimed tnt = world.spawn(tntloc, TNTPrimed.class); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandpay.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.ChargeException; 4 | import com.earth2me.essentials.CommandSource; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import com.earth2me.essentials.Trade; 7 | import com.earth2me.essentials.User; 8 | import java.math.BigDecimal; 9 | import net.ess3.api.MaxMoneyException; 10 | import org.bukkit.Server; 11 | 12 | 13 | public class Commandpay extends EssentialsLoopCommand 14 | { 15 | BigDecimal amount; 16 | 17 | public Commandpay() 18 | { 19 | super("pay"); 20 | } 21 | 22 | @Override 23 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 24 | { 25 | if (args.length < 2) 26 | { 27 | throw new NotEnoughArgumentsException(); 28 | } 29 | 30 | String stringAmount = args[1].replaceAll("[^0-9\\.]", ""); 31 | 32 | if (stringAmount.length() < 1) 33 | { 34 | throw new NotEnoughArgumentsException(); 35 | } 36 | 37 | amount = new BigDecimal(stringAmount); 38 | loopOnlinePlayers(server, user.getSource(), false, user.isAuthorized("essentials.pay.multiple"), args[0], args); 39 | } 40 | 41 | @Override 42 | protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws ChargeException 43 | { 44 | User user = ess.getUser(sender.getPlayer()); 45 | try 46 | { 47 | user.payUser(player, amount); 48 | Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess); 49 | } 50 | catch (MaxMoneyException ex) 51 | { 52 | sender.sendMessage(tl("maxMoney")); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandping.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.utils.FormatUtil; 6 | import org.bukkit.Server; 7 | 8 | // This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg 9 | public class Commandping extends EssentialsCommand 10 | { 11 | public Commandping() 12 | { 13 | super("ping"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 1) 20 | { 21 | 22 | sender.sendMessage(tl("pong")); 23 | } 24 | else 25 | { 26 | sender.sendMessage(FormatUtil.replaceFormat(getFinalArg(args, 0))); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandpowertooltoggle extends EssentialsCommand 9 | { 10 | public Commandpowertooltoggle() 11 | { 12 | super("powertooltoggle"); 13 | } 14 | 15 | @Override 16 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | if (!user.hasPowerTools()) 19 | { 20 | user.sendMessage(tl("noPowerTools")); 21 | return; 22 | } 23 | user.sendMessage(user.togglePowerToolsEnabled() 24 | ? tl("powerToolsEnabled") 25 | : tl("powerToolsDisabled")); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandrealname.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.FormatUtil; 7 | import java.util.Locale; 8 | import org.bukkit.Server; 9 | import org.bukkit.entity.Player; 10 | 11 | 12 | public class Commandrealname extends EssentialsCommand 13 | { 14 | public Commandrealname() 15 | { 16 | super("realname"); 17 | } 18 | 19 | @Override 20 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (args.length < 1) 23 | { 24 | throw new NotEnoughArgumentsException(); 25 | } 26 | final String whois = args[0].toLowerCase(Locale.ENGLISH); 27 | boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished(); 28 | boolean foundUser = false; 29 | for (User u: ess.getOnlineUsers()) 30 | { 31 | if (skipHidden && u.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(u.getBase())) 32 | { 33 | continue; 34 | } 35 | u.setDisplayNick(); 36 | final String displayName = FormatUtil.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH); 37 | if (displayName.contains(whois)) 38 | { 39 | foundUser = true; 40 | sender.sendMessage(u.getDisplayName() + " " + tl("is") + " " + u.getName()); 41 | } 42 | } 43 | if (!foundUser) 44 | { 45 | throw new PlayerNotFoundException(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandrules.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.textreader.IText; 5 | import com.earth2me.essentials.textreader.KeywordReplacer; 6 | import com.earth2me.essentials.textreader.TextInput; 7 | import com.earth2me.essentials.textreader.TextPager; 8 | import org.bukkit.Server; 9 | 10 | 11 | public class Commandrules extends EssentialsCommand 12 | { 13 | public Commandrules() 14 | { 15 | super("rules"); 16 | } 17 | 18 | @Override 19 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 20 | { 21 | if (sender.isPlayer()) 22 | { 23 | ess.getUser(sender.getPlayer()).setDisplayNick(); 24 | } 25 | 26 | final IText input = new TextInput(sender, "rules", true, ess); 27 | final IText output = new KeywordReplacer(input, sender, ess); 28 | final TextPager pager = new TextPager(output); 29 | pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.utils.StringUtil; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandsetjail extends EssentialsCommand 10 | { 11 | public Commandsetjail() 12 | { 13 | super("setjail"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 1) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | ess.getJails().setJail(args[0], user.getLocation()); 24 | user.sendMessage(tl("jailSet", StringUtil.sanitizeString(args[0]))); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.api.IWarps; 6 | import com.earth2me.essentials.utils.NumberUtil; 7 | import com.earth2me.essentials.utils.StringUtil; 8 | import net.ess3.api.InvalidWorldException; 9 | import org.bukkit.Location; 10 | import org.bukkit.Server; 11 | 12 | 13 | public class Commandsetwarp extends EssentialsCommand 14 | { 15 | public Commandsetwarp() 16 | { 17 | super("setwarp"); 18 | } 19 | 20 | @Override 21 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 22 | { 23 | if (args.length < 1) 24 | { 25 | throw new NotEnoughArgumentsException(); 26 | } 27 | 28 | if (NumberUtil.isInt(args[0]) || args[0].isEmpty()) 29 | { 30 | throw new NoSuchFieldException(tl("invalidWarpName")); 31 | } 32 | 33 | final Location loc = user.getLocation(); 34 | final IWarps warps = ess.getWarps(); 35 | Location warpLoc = null; 36 | 37 | try 38 | { 39 | warpLoc = warps.getWarp(args[0]); 40 | } 41 | catch (WarpNotFoundException ex) 42 | { 43 | } 44 | catch (InvalidWorldException ex) 45 | { 46 | } 47 | 48 | if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + StringUtil.safeString(args[0]))) 49 | { 50 | warps.setWarp(args[0], loc); 51 | } 52 | else 53 | { 54 | throw new Exception(tl("warpOverwrite")); 55 | } 56 | user.sendMessage(tl("warpSet", args[0])); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | 10 | public class Commandsetworth extends EssentialsCommand 11 | { 12 | public Commandsetworth() 13 | { 14 | super("setworth"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | if (args.length < 1) 21 | { 22 | throw new NotEnoughArgumentsException(); 23 | } 24 | 25 | ItemStack stack; 26 | String price; 27 | 28 | if (args.length == 1) 29 | { 30 | stack = user.getBase().getInventory().getItemInHand(); 31 | price = args[0]; 32 | } 33 | else 34 | { 35 | stack = ess.getItemDb().get(args[0]); 36 | price = args[1]; 37 | } 38 | 39 | ess.getWorth().setPrice(stack, Double.parseDouble(price)); 40 | user.sendMessage(tl("worthSet")); 41 | } 42 | 43 | @Override 44 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 45 | { 46 | if (args.length < 2) 47 | { 48 | throw new NotEnoughArgumentsException(); 49 | } 50 | 51 | ItemStack stack = ess.getItemDb().get(args[0]); 52 | ess.getWorth().setPrice(stack, Double.parseDouble(args[1])); 53 | sender.sendMessage(tl("worthSet")); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | import org.bukkit.event.entity.EntityDamageEvent; 7 | 8 | 9 | public class Commandsuicide extends EssentialsCommand 10 | { 11 | public Commandsuicide() 12 | { 13 | super("suicide"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, Short.MAX_VALUE); 20 | server.getPluginManager().callEvent(ede); 21 | user.getBase().damage(Short.MAX_VALUE); 22 | if (user.getBase().getHealth() > 0) 23 | { 24 | user.getBase().setHealth(0); 25 | } 26 | user.sendMessage(tl("suicideMessage")); 27 | user.setDisplayNick(); 28 | ess.broadcastMessage(user, tl("suicideSuccess", user.getDisplayName())); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandthunder.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | import org.bukkit.World; 7 | 8 | 9 | public class Commandthunder extends EssentialsCommand 10 | { 11 | public Commandthunder() 12 | { 13 | super("thunder"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 1) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | 24 | final World world = user.getWorld(); 25 | final boolean setThunder = args[0].equalsIgnoreCase("true"); 26 | if (args.length > 1) 27 | { 28 | 29 | world.setThundering(setThunder ? true : false); 30 | world.setThunderDuration(Integer.parseInt(args[1]) * 20); 31 | user.sendMessage(tl("thunderDuration", (setThunder ? tl("enabled") : tl("disabled")), Integer.parseInt(args[1]))); 32 | 33 | } 34 | else 35 | { 36 | world.setThundering(setThunder ? true : false); 37 | user.sendMessage(tl("thunder", setThunder ? tl("enabled") : tl("disabled"))); 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtop.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.utils.LocationUtil; 7 | import org.bukkit.Location; 8 | import org.bukkit.Server; 9 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 10 | 11 | 12 | public class Commandtop extends EssentialsCommand 13 | { 14 | public Commandtop() 15 | { 16 | super("top"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 21 | { 22 | final int topX = user.getLocation().getBlockX(); 23 | final int topZ = user.getLocation().getBlockZ(); 24 | final float pitch = user.getLocation().getPitch(); 25 | final float yaw = user.getLocation().getYaw(); 26 | final Location loc = LocationUtil.getSafeDestination(new Location(user.getWorld(), topX, user.getWorld().getMaxHeight(), topZ, yaw, pitch)); 27 | user.getTeleport().teleport(loc, new Trade(this.getName(), ess), TeleportCause.COMMAND); 28 | user.sendMessage(tl("teleportTop", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpa.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandtpa extends EssentialsCommand 9 | { 10 | public Commandtpa() 11 | { 12 | super("tpa"); 13 | } 14 | 15 | @Override 16 | public void run(Server server, User user, String commandLabel, String[] args) throws Exception 17 | { 18 | if (args.length < 1) 19 | { 20 | throw new NotEnoughArgumentsException(); 21 | } 22 | 23 | User player = getPlayer(server, user, args, 0); 24 | if (user.getName().equalsIgnoreCase(player.getName())) 25 | { 26 | throw new NotEnoughArgumentsException(); 27 | } 28 | if (!player.isTeleportEnabled()) 29 | { 30 | throw new Exception(tl("teleportDisabled", player.getDisplayName())); 31 | } 32 | if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 33 | && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) 34 | { 35 | throw new Exception(tl("noPerm", "essentials.worlds." + player.getWorld().getName())); 36 | } 37 | if (!player.isIgnoredPlayer(user)) 38 | { 39 | player.requestTeleport(user, false); 40 | player.sendMessage(tl("teleportRequest", user.getDisplayName())); 41 | player.sendMessage(tl("typeTpaccept")); 42 | player.sendMessage(tl("typeTpdeny")); 43 | if (ess.getSettings().getTpaAcceptCancellation() != 0) 44 | { 45 | player.sendMessage(tl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); 46 | } 47 | } 48 | user.sendMessage(tl("requestSent", player.getDisplayName())); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandtpahere extends EssentialsCommand 9 | { 10 | public Commandtpahere() 11 | { 12 | super("tpahere"); 13 | } 14 | 15 | @Override 16 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | if (args.length < 1) 19 | { 20 | throw new NotEnoughArgumentsException(); 21 | } 22 | 23 | final User player = getPlayer(server, user, args, 0); 24 | if (user.getName().equalsIgnoreCase(player.getName())) 25 | { 26 | throw new NotEnoughArgumentsException(); 27 | } 28 | if (!player.isTeleportEnabled()) 29 | { 30 | throw new Exception(tl("teleportDisabled", player.getDisplayName())); 31 | } 32 | if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 33 | && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) 34 | { 35 | throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName())); 36 | } 37 | if (!player.isIgnoredPlayer(user)) 38 | { 39 | player.requestTeleport(user, true); 40 | player.sendMessage(tl("teleportHereRequest", user.getDisplayName())); 41 | player.sendMessage(tl("typeTpaccept")); 42 | player.sendMessage(tl("typeTpdeny")); 43 | if (ess.getSettings().getTpaAcceptCancellation() != 0) 44 | { 45 | player.sendMessage(tl("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); 46 | } 47 | } 48 | user.sendMessage(tl("requestSent", player.getDisplayName())); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpall.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Location; 7 | import org.bukkit.Server; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 10 | 11 | 12 | public class Commandtpall extends EssentialsCommand 13 | { 14 | public Commandtpall() 15 | { 16 | super("tpall"); 17 | } 18 | 19 | @Override 20 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 21 | { 22 | if (args.length < 1) 23 | { 24 | if (sender.isPlayer()) 25 | { 26 | teleportAllPlayers(server, sender, ess.getUser(sender.getPlayer())); 27 | return; 28 | } 29 | throw new NotEnoughArgumentsException(); 30 | } 31 | 32 | final User target = getPlayer(server, sender, args, 0); 33 | teleportAllPlayers(server, sender, target); 34 | } 35 | 36 | private void teleportAllPlayers(Server server, CommandSource sender, User target) 37 | { 38 | sender.sendMessage(tl("teleportAll")); 39 | final Location loc = target.getLocation(); 40 | for (User player : ess.getOnlineUsers()) 41 | { 42 | if (target == player) 43 | { 44 | continue; 45 | } 46 | if (sender.equals(target.getBase()) 47 | && target.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 48 | && !target.isAuthorized("essentials.worlds." + target.getWorld().getName())) 49 | { 50 | continue; 51 | } 52 | try 53 | { 54 | player.getTeleport().now(loc, false, TeleportCause.COMMAND); 55 | } 56 | catch (Exception ex) 57 | { 58 | ess.showError(sender, ex, getName()); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | 7 | 8 | public class Commandtpdeny extends EssentialsCommand 9 | { 10 | public Commandtpdeny() 11 | { 12 | super("tpdeny"); 13 | } 14 | 15 | @Override 16 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | final User player = ess.getUser(user.getTeleportRequest()); 19 | if (player == null) 20 | { 21 | throw new Exception(tl("noPendingRequest")); 22 | } 23 | 24 | user.sendMessage(tl("requestDenied")); 25 | player.sendMessage(tl("requestDeniedFrom", user.getDisplayName())); 26 | user.requestTeleport(null, false); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtphere.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 8 | 9 | 10 | public class Commandtphere extends EssentialsCommand 11 | { 12 | public Commandtphere() 13 | { 14 | super("tphere"); 15 | } 16 | 17 | @Override 18 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 19 | { 20 | final User player = getPlayer(server, user, args, 0); 21 | if (!player.isTeleportEnabled()) 22 | { 23 | throw new Exception(tl("teleportDisabled", player.getDisplayName())); 24 | } 25 | if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 26 | && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) 27 | { 28 | throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName())); 29 | } 30 | user.getTeleport().teleportPlayer(player, user.getBase(), new Trade(this.getName(), ess), TeleportCause.COMMAND); 31 | throw new NoChargeException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpo.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 7 | 8 | 9 | public class Commandtpo extends EssentialsCommand 10 | { 11 | public Commandtpo() 12 | { 13 | super("tpo"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | switch (args.length) 20 | { 21 | case 0: 22 | throw new NotEnoughArgumentsException(); 23 | 24 | case 1: 25 | final User player = getPlayer(server, user, args, 0); 26 | if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 27 | && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) 28 | { 29 | throw new Exception(tl("noPerm", "essentials.worlds." + player.getWorld().getName())); 30 | } 31 | user.getTeleport().now(player.getBase(), false, TeleportCause.COMMAND); 32 | break; 33 | 34 | default: 35 | if (!user.isAuthorized("essentials.tp.others")) 36 | { 37 | throw new Exception(tl("noPerm", "essentials.tp.others")); 38 | } 39 | final User target = getPlayer(server, user, args, 0); 40 | final User toPlayer = getPlayer(server, user, args, 1); 41 | 42 | if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() 43 | && !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName())) 44 | { 45 | throw new Exception(tl("noPerm", "essentials.worlds." + toPlayer.getWorld().getName())); 46 | } 47 | 48 | target.getTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND); 49 | target.sendMessage(tl("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); 50 | break; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import org.bukkit.Server; 6 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 7 | 8 | 9 | public class Commandtpohere extends EssentialsCommand 10 | { 11 | public Commandtpohere() 12 | { 13 | super("tpohere"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | if (args.length < 1) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | 24 | //Just basically the old tphere command 25 | final User player = getPlayer(server, user, args, 0); 26 | 27 | if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() 28 | && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) 29 | { 30 | throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName())); 31 | } 32 | 33 | // Verify permission 34 | player.getTeleport().now(user.getBase(), false, TeleportCause.COMMAND); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.User; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandtptoggle extends EssentialsToggleCommand 10 | { 11 | public Commandtptoggle() 12 | { 13 | super("tptoggle", "essentials.tptoggle.others"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 18 | { 19 | toggleOtherPlayers(server, sender, args); 20 | } 21 | 22 | @Override 23 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 24 | { 25 | if (args.length == 1) 26 | { 27 | Boolean toggle = matchToggleArgument(args[0]); 28 | if (toggle == null && user.isAuthorized(othersPermission)) 29 | { 30 | toggleOtherPlayers(server, user.getSource(), args); 31 | } 32 | else 33 | { 34 | togglePlayer(user.getSource(), user, toggle); 35 | } 36 | } 37 | else if (args.length == 2 && user.isAuthorized(othersPermission)) 38 | { 39 | toggleOtherPlayers(server, user.getSource(), args); 40 | } 41 | else 42 | { 43 | togglePlayer(user.getSource(), user, null); 44 | } 45 | } 46 | 47 | @Override 48 | void togglePlayer(CommandSource sender, User user, Boolean enabled) 49 | { 50 | if (enabled == null) 51 | { 52 | enabled = !user.isTeleportEnabled(); 53 | } 54 | 55 | user.setTeleportEnabled(enabled); 56 | 57 | user.sendMessage(enabled ? tl("teleportationEnabled") : tl("teleportationDisabled")); 58 | if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) 59 | { 60 | sender.sendMessage(enabled ? tl("teleportationEnabledFor", user.getDisplayName()) : tl("teleportationDisabledFor", user.getDisplayName())); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandunban.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.Console; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import com.earth2me.essentials.User; 7 | import java.util.logging.Level; 8 | import org.bukkit.BanList; 9 | import org.bukkit.Bukkit; 10 | import org.bukkit.OfflinePlayer; 11 | import org.bukkit.Server; 12 | 13 | 14 | public class Commandunban extends EssentialsCommand 15 | { 16 | public Commandunban() 17 | { 18 | super("unban"); 19 | } 20 | 21 | @Override 22 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 23 | { 24 | if (args.length < 1) 25 | { 26 | throw new NotEnoughArgumentsException(); 27 | } 28 | String name; 29 | try 30 | { 31 | final User user = getPlayer(server, args, 0, true, true); 32 | name = user.getName(); 33 | ess.getServer().getBanList(BanList.Type.NAME).pardon(name); 34 | } 35 | catch (NoSuchFieldException e) 36 | { 37 | final OfflinePlayer player = server.getOfflinePlayer(args[0]); 38 | name = player.getName(); 39 | if (!player.isBanned()) 40 | { 41 | throw new Exception(tl("playerNotFound"), e); 42 | } 43 | ess.getServer().getBanList(BanList.Type.NAME).pardon(name); 44 | } 45 | 46 | final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; 47 | server.getLogger().log(Level.INFO, tl("playerUnbanned", senderName, name)); 48 | 49 | ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanned", senderName, name)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.Console; 5 | import static com.earth2me.essentials.I18n.tl; 6 | import com.earth2me.essentials.User; 7 | import com.earth2me.essentials.utils.FormatUtil; 8 | import java.util.logging.Level; 9 | import org.bukkit.BanList; 10 | import org.bukkit.Bukkit; 11 | import org.bukkit.Server; 12 | 13 | 14 | public class Commandunbanip extends EssentialsCommand 15 | { 16 | public Commandunbanip() 17 | { 18 | super("unbanip"); 19 | } 20 | 21 | @Override 22 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 23 | { 24 | if (args.length < 1) 25 | { 26 | throw new NotEnoughArgumentsException(); 27 | } 28 | 29 | String ipAddress; 30 | if (FormatUtil.validIP(args[0])) 31 | { 32 | ipAddress = args[0]; 33 | } 34 | else 35 | { 36 | try 37 | { 38 | User player = getPlayer(server, args, 0, true, true); 39 | ipAddress = player.getLastLoginAddress(); 40 | } 41 | catch (PlayerNotFoundException ex) 42 | { 43 | ipAddress = args[0]; 44 | } 45 | } 46 | 47 | if (ipAddress.isEmpty()) 48 | { 49 | throw new PlayerNotFoundException(); 50 | } 51 | 52 | 53 | ess.getServer().getBanList(BanList.Type.IP).pardon(ipAddress); 54 | final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; 55 | server.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderName, ipAddress)); 56 | 57 | ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanIpAddress", senderName, ipAddress)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/Commandworkbench.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.User; 4 | import org.bukkit.Server; 5 | 6 | 7 | public class Commandworkbench extends EssentialsCommand 8 | { 9 | public Commandworkbench() 10 | { 11 | super("workbench"); 12 | } 13 | 14 | 15 | @Override 16 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 17 | { 18 | user.getBase().openWorkbench(null, true); 19 | } 20 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.IEssentialsModule; 5 | import com.earth2me.essentials.User; 6 | import net.ess3.api.IEssentials; 7 | import org.bukkit.Server; 8 | import org.bukkit.command.Command; 9 | 10 | 11 | public interface IEssentialsCommand 12 | { 13 | String getName(); 14 | 15 | void run(Server server, User user, String commandLabel, Command cmd, String[] args) 16 | throws Exception; 17 | 18 | void run(Server server, CommandSource sender, String commandLabel, Command cmd, String[] args) 19 | throws Exception; 20 | 21 | void setEssentials(IEssentials ess); 22 | 23 | void setEssentialsModule(IEssentialsModule module); 24 | } 25 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/NoChargeException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | 4 | public class NoChargeException extends Exception 5 | { 6 | public NoChargeException() 7 | { 8 | super("Will charge later"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | 4 | public class NotEnoughArgumentsException extends Exception 5 | { 6 | public NotEnoughArgumentsException() 7 | { 8 | super(""); 9 | } 10 | 11 | public NotEnoughArgumentsException(final String string) 12 | { 13 | super(string); 14 | } 15 | 16 | public NotEnoughArgumentsException(final Throwable ex) 17 | { 18 | super("", ex); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/PlayerExemptException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | public class PlayerExemptException extends NoSuchFieldException 4 | { 5 | public PlayerExemptException(String message) 6 | { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/PlayerNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | public class PlayerNotFoundException extends NoSuchFieldException 6 | { 7 | public PlayerNotFoundException() 8 | { 9 | super(tl("playerNotFound")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/QuietAbortException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | 4 | public class QuietAbortException extends Exception 5 | { 6 | public QuietAbortException() 7 | { 8 | super(); 9 | } 10 | 11 | public QuietAbortException(String message) 12 | { 13 | super(message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.commands; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | public class WarpNotFoundException extends Exception 6 | { 7 | public WarpNotFoundException() 8 | { 9 | super(tl("warpNotExist")); 10 | } 11 | 12 | public WarpNotFoundException(String message) 13 | { 14 | super(message); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/craftbukkit/BanLookup.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.craftbukkit; 2 | 3 | import com.earth2me.essentials.User; 4 | import java.util.Iterator; 5 | import java.util.Set; 6 | import net.ess3.api.IEssentials; 7 | import org.bukkit.BanEntry; 8 | import org.bukkit.BanList; 9 | 10 | 11 | public class BanLookup 12 | { 13 | public static Boolean isBanned(IEssentials ess, User user) 14 | { 15 | return isBanned(ess, user.getName()); 16 | } 17 | 18 | public static Boolean isBanned(IEssentials ess, String name) 19 | { 20 | return getBanEntry(ess, name) != null; 21 | } 22 | 23 | public static BanEntry getBanEntry(IEssentials ess, String name) 24 | { 25 | Set benteries = ess.getServer().getBanList(BanList.Type.NAME).getBanEntries(); 26 | for (BanEntry banEnt : benteries) 27 | { 28 | if (banEnt.getTarget().equals(name)) 29 | { 30 | return banEnt; 31 | } 32 | } 33 | return null; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.metrics; 2 | 3 | import com.earth2me.essentials.User; 4 | import java.util.logging.Level; 5 | import net.ess3.api.IEssentials; 6 | import org.bukkit.Server; 7 | import org.bukkit.event.EventHandler; 8 | import org.bukkit.event.EventPriority; 9 | import org.bukkit.event.Listener; 10 | import org.bukkit.event.player.PlayerJoinEvent; 11 | 12 | 13 | public class MetricsListener implements Listener 14 | { 15 | private final transient Server server; 16 | private final transient IEssentials ess; 17 | private final transient MetricsStarter starter; 18 | 19 | public MetricsListener(final IEssentials parent, final MetricsStarter starter) 20 | { 21 | this.ess = parent; 22 | this.server = parent.getServer(); 23 | this.starter = starter; 24 | } 25 | 26 | @EventHandler(priority = EventPriority.MONITOR) 27 | public void onPlayerJoin(final PlayerJoinEvent event) 28 | { 29 | final User player = ess.getUser(event.getPlayer()); 30 | if (ess.getSettings().isMetricsEnabled() == false && (player.isAuthorized("essentials.essentials") || player.isAuthorized("bukkit.broadcast.admin"))) 31 | { 32 | player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes."); 33 | player.sendMessage("To opt out, disabling metrics for all plugins, run /essentials opt-out"); 34 | ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period."); 35 | ess.getSettings().setMetricsEnabled(true); 36 | ess.runTaskLaterAsynchronously(starter, 5 * 1200); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import de.bananaco.bpermissions.api.ApiLayer; 4 | import de.bananaco.bpermissions.api.util.CalculableType; 5 | import java.util.Arrays; 6 | import java.util.List; 7 | import org.bukkit.entity.Player; 8 | 9 | 10 | public class BPermissions2Handler extends SuperpermsHandler 11 | { 12 | public BPermissions2Handler() 13 | { 14 | 15 | } 16 | 17 | @Override 18 | public String getGroup(final Player base) 19 | { 20 | final List groups = getGroups(base); 21 | if (groups == null || groups.isEmpty()) 22 | { 23 | return null; 24 | } 25 | return groups.get(0); 26 | } 27 | 28 | @Override 29 | public List getGroups(final Player base) 30 | { 31 | final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName()); 32 | return Arrays.asList(groups); 33 | } 34 | 35 | @Override 36 | public boolean inGroup(final Player base, final String group) 37 | { 38 | return ApiLayer.hasGroupRecursive(base.getWorld().getName(), CalculableType.USER, base.getName(), group); 39 | } 40 | 41 | @Override 42 | public boolean canBuild(final Player base, final String group) 43 | { 44 | return hasPermission(base, "bPermissions.build"); 45 | } 46 | 47 | @Override 48 | public String getPrefix(final Player base) 49 | { 50 | return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix"); 51 | } 52 | 53 | @Override 54 | public String getSuffix(final Player base) 55 | { 56 | return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix"); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import net.ess3.api.IEssentials; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.plugin.Plugin; 6 | 7 | 8 | public class ConfigPermissionsHandler extends SuperpermsHandler 9 | { 10 | private final transient IEssentials ess; 11 | 12 | public ConfigPermissionsHandler(final Plugin ess) 13 | { 14 | this.ess = (IEssentials)ess; 15 | } 16 | 17 | @Override 18 | public boolean canBuild(final Player base, final String group) 19 | { 20 | return true; 21 | } 22 | 23 | @Override 24 | public boolean hasPermission(final Player base, final String node) 25 | { 26 | final String[] cmds = node.split("\\.", 2); 27 | return ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]) || super.hasPermission(base, node); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import java.util.List; 4 | import org.bukkit.entity.Player; 5 | 6 | 7 | public interface IPermissionsHandler 8 | { 9 | String getGroup(Player base); 10 | 11 | List getGroups(Player base); 12 | 13 | boolean canBuild(Player base, String group); 14 | 15 | boolean inGroup(Player base, String group); 16 | 17 | boolean hasPermission(Player base, String node); 18 | 19 | String getPrefix(Player base); 20 | 21 | String getSuffix(Player base); 22 | } 23 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/NullPermissionsHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | import org.bukkit.entity.Player; 6 | 7 | 8 | public class NullPermissionsHandler implements IPermissionsHandler 9 | { 10 | @Override 11 | public String getGroup(final Player base) 12 | { 13 | return null; 14 | } 15 | 16 | @Override 17 | public List getGroups(final Player base) 18 | { 19 | return Collections.emptyList(); 20 | } 21 | 22 | @Override 23 | public boolean canBuild(final Player base, final String group) 24 | { 25 | return false; 26 | } 27 | 28 | @Override 29 | public boolean inGroup(final Player base, final String group) 30 | { 31 | return false; 32 | } 33 | 34 | @Override 35 | public boolean hasPermission(final Player base, final String node) 36 | { 37 | return false; 38 | } 39 | 40 | @Override 41 | public String getPrefix(final Player base) 42 | { 43 | return null; 44 | } 45 | 46 | @Override 47 | public String getSuffix(final Player base) 48 | { 49 | return null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import net.krinsoft.privileges.Privileges; 6 | import net.krinsoft.privileges.groups.Group; 7 | import net.krinsoft.privileges.groups.GroupManager; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.plugin.Plugin; 10 | 11 | public class PrivilegesHandler extends SuperpermsHandler 12 | { 13 | private final transient Privileges plugin; 14 | private final GroupManager manager; 15 | 16 | public PrivilegesHandler(final Plugin plugin) 17 | { 18 | this.plugin = (Privileges) plugin; 19 | this.manager = this.plugin.getGroupManager(); 20 | } 21 | 22 | @Override 23 | public String getGroup(final Player base) 24 | { 25 | Group group = manager.getGroup(base); 26 | if (group == null) 27 | { 28 | return null; 29 | } 30 | return group.getName(); 31 | } 32 | 33 | @Override 34 | public List getGroups(final Player base) 35 | { 36 | Group group = manager.getGroup(base); 37 | if (group == null) 38 | { 39 | return new ArrayList(); 40 | } 41 | return group.getGroupTree(); 42 | } 43 | 44 | @Override 45 | public boolean inGroup(final Player base, final String group) 46 | { 47 | Group pGroup = manager.getGroup(base); 48 | if (pGroup == null) 49 | { 50 | return false; 51 | } 52 | return pGroup.isMemberOf(group); 53 | } 54 | 55 | @Override 56 | public boolean canBuild(Player base, String group) 57 | { 58 | return hasPermission(base, "privileges.build"); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/SimplyPermsHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import java.util.List; 4 | import net.crystalyx.bukkit.simplyperms.SimplyAPI; 5 | import net.crystalyx.bukkit.simplyperms.SimplyPlugin; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | public class SimplyPermsHandler extends SuperpermsHandler 10 | { 11 | 12 | private final transient SimplyAPI api; 13 | 14 | public SimplyPermsHandler(final Plugin plugin) 15 | { 16 | this.api = ((SimplyPlugin) plugin).getAPI(); 17 | } 18 | 19 | @Override 20 | public String getGroup(final Player base) 21 | { 22 | final List groups = api.getPlayerGroups(base.getName()); 23 | if (groups == null || groups.isEmpty()) 24 | { 25 | return null; 26 | } 27 | return groups.get(0); 28 | } 29 | 30 | @Override 31 | public List getGroups(final Player base) 32 | { 33 | return api.getPlayerGroups(base.getName()); 34 | } 35 | 36 | @Override 37 | public boolean inGroup(final Player base, final String group) 38 | { 39 | final List groups = api.getPlayerGroups(base.getName()); 40 | for (String group1 : groups) 41 | { 42 | if (group1.equalsIgnoreCase(group)) 43 | { 44 | return true; 45 | } 46 | } 47 | return false; 48 | } 49 | 50 | @Override 51 | public boolean canBuild(Player base, String group) 52 | { 53 | return hasPermission(base, "permissions.allow.build"); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.perm; 2 | 3 | import java.util.List; 4 | import org.bukkit.entity.Player; 5 | 6 | 7 | public class SuperpermsHandler implements IPermissionsHandler 8 | { 9 | @Override 10 | public String getGroup(final Player base) 11 | { 12 | return null; 13 | } 14 | 15 | @Override 16 | public List getGroups(final Player base) 17 | { 18 | return null; 19 | } 20 | 21 | @Override 22 | public boolean canBuild(final Player base, final String group) 23 | { 24 | return false; 25 | } 26 | 27 | @Override 28 | public boolean inGroup(final Player base, final String group) 29 | { 30 | return hasPermission(base, "group." + group); 31 | } 32 | 33 | @Override 34 | public boolean hasPermission(final Player base, String node) 35 | { 36 | String permCheck = node; 37 | int index; 38 | while (true) 39 | { 40 | if (base.isPermissionSet(permCheck)) 41 | { 42 | return base.hasPermission(permCheck); 43 | } 44 | 45 | index = node.lastIndexOf('.'); 46 | if (index < 1) 47 | { 48 | return base.hasPermission("*"); 49 | } 50 | 51 | node = node.substring(0, index); 52 | permCheck = node + ".*"; 53 | } 54 | } 55 | 56 | @Override 57 | public String getPrefix(final Player base) 58 | { 59 | return null; 60 | } 61 | 62 | @Override 63 | public String getSuffix(final Player base) 64 | { 65 | return null; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/settings/Jails.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.settings; 2 | 3 | import com.earth2me.essentials.storage.MapValueType; 4 | import com.earth2me.essentials.storage.StorageObject; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import org.bukkit.Location; 10 | 11 | 12 | @Data 13 | @EqualsAndHashCode(callSuper = false) 14 | public class Jails implements StorageObject 15 | { 16 | @MapValueType(Location.class) 17 | private Map jails = new HashMap(); 18 | } 19 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/settings/Spawns.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.settings; 2 | 3 | import com.earth2me.essentials.storage.MapValueType; 4 | import com.earth2me.essentials.storage.StorageObject; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import org.bukkit.Location; 10 | 11 | 12 | @Data 13 | @EqualsAndHashCode(callSuper = false) 14 | public class Spawns implements StorageObject 15 | { 16 | @MapValueType(Location.class) 17 | private Map spawns = new HashMap(); 18 | } 19 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignBalance.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.utils.NumberUtil; 6 | import net.ess3.api.IEssentials; 7 | 8 | 9 | public class SignBalance extends EssentialsSign 10 | { 11 | public SignBalance() 12 | { 13 | super("Balance"); 14 | } 15 | 16 | @Override 17 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 18 | { 19 | player.sendMessage(tl("balance", NumberUtil.displayCurrency(player.getMoney(), ess))); 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignBuy.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.ChargeException; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import net.ess3.api.IEssentials; 7 | import net.ess3.api.MaxMoneyException; 8 | 9 | 10 | public class SignBuy extends EssentialsSign 11 | { 12 | public SignBuy() 13 | { 14 | super("Buy"); 15 | } 16 | 17 | @Override 18 | protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 19 | { 20 | validateTrade(sign, 1, 2, player, ess); 21 | validateTrade(sign, 3, ess); 22 | return true; 23 | } 24 | 25 | @Override 26 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException 27 | { 28 | final Trade items = getTrade(sign, 1, 2, player, ess); 29 | final Trade charge = getTrade(sign, 3, ess); 30 | charge.isAffordableFor(player); 31 | if (!items.pay(player)) 32 | { 33 | throw new ChargeException("Inventory full"); //TODO: TL 34 | } 35 | charge.charge(player); 36 | Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), ess); 37 | return true; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignDisposal.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.User; 4 | import net.ess3.api.IEssentials; 5 | 6 | 7 | public class SignDisposal extends EssentialsSign 8 | { 9 | public SignDisposal() 10 | { 11 | super("Disposal"); 12 | } 13 | 14 | @Override 15 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) 16 | { 17 | player.getBase().openInventory(ess.getServer().createInventory(player.getBase(), 36, "Disposal")); 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | 4 | public class SignException extends Exception 5 | { 6 | public SignException(final String message) 7 | { 8 | super(message); 9 | } 10 | 11 | public SignException(final String message, final Throwable throwable) 12 | { 13 | super(message, throwable); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignHeal.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.ChargeException; 4 | import static com.earth2me.essentials.I18n.tl; 5 | import com.earth2me.essentials.Trade; 6 | import com.earth2me.essentials.User; 7 | import net.ess3.api.IEssentials; 8 | 9 | 10 | public class SignHeal extends EssentialsSign 11 | { 12 | public SignHeal() 13 | { 14 | super("Heal"); 15 | } 16 | 17 | @Override 18 | protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 19 | { 20 | validateTrade(sign, 1, ess); 21 | return true; 22 | } 23 | 24 | @Override 25 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException 26 | { 27 | if (player.getBase().getHealth() == 0) 28 | { 29 | throw new SignException(tl("healDead")); 30 | } 31 | final Trade charge = getTrade(sign, 1, ess); 32 | charge.isAffordableFor(player); 33 | player.getBase().setHealth(20); 34 | player.getBase().setFoodLevel(20); 35 | player.getBase().setFireTicks(0); 36 | player.sendMessage(tl("youAreHealed")); 37 | charge.charge(player); 38 | Trade.log("Sign", "Heal", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess); 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignInfo.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.ChargeException; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.User; 6 | import com.earth2me.essentials.textreader.IText; 7 | import com.earth2me.essentials.textreader.KeywordReplacer; 8 | import com.earth2me.essentials.textreader.TextInput; 9 | import com.earth2me.essentials.textreader.TextPager; 10 | import java.io.IOException; 11 | import net.ess3.api.IEssentials; 12 | 13 | 14 | public class SignInfo extends EssentialsSign 15 | { 16 | public SignInfo() 17 | { 18 | super("Info"); 19 | } 20 | 21 | @Override 22 | protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 23 | { 24 | validateTrade(sign, 3, ess); 25 | return true; 26 | } 27 | 28 | @Override 29 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException 30 | { 31 | final Trade charge = getTrade(sign, 3, ess); 32 | charge.isAffordableFor(player); 33 | 34 | String chapter = sign.getLine(1); 35 | String page = sign.getLine(2); 36 | 37 | final IText input; 38 | try 39 | { 40 | player.setDisplayNick(); 41 | input = new TextInput(player.getSource(), "info", true, ess); 42 | final IText output = new KeywordReplacer(input, player.getSource(), ess); 43 | final TextPager pager = new TextPager(output); 44 | pager.showPage(chapter, page, null, player.getSource()); 45 | 46 | } 47 | catch (IOException ex) 48 | { 49 | throw new SignException(ex.getMessage(), ex); 50 | } 51 | 52 | charge.charge(player); 53 | Trade.log("Sign", "Info", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess); 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignMail.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import java.util.List; 6 | import net.ess3.api.IEssentials; 7 | 8 | 9 | public class SignMail extends EssentialsSign 10 | { 11 | public SignMail() 12 | { 13 | super("Mail"); 14 | } 15 | 16 | @Override 17 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 18 | { 19 | final List mail = player.getMails(); 20 | if (mail.isEmpty()) 21 | { 22 | player.sendMessage(tl("noNewMail")); 23 | return false; 24 | } 25 | for (String s : mail) 26 | { 27 | player.sendMessage(s); 28 | } 29 | player.sendMessage(tl("markMailAsRead")); 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignSell.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.ChargeException; 4 | import com.earth2me.essentials.Trade; 5 | import com.earth2me.essentials.Trade.OverflowType; 6 | import com.earth2me.essentials.User; 7 | import net.ess3.api.IEssentials; 8 | import net.ess3.api.MaxMoneyException; 9 | 10 | 11 | public class SignSell extends EssentialsSign 12 | { 13 | public SignSell() 14 | { 15 | super("Sell"); 16 | } 17 | 18 | @Override 19 | protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException 20 | { 21 | validateTrade(sign, 1, 2, player, ess); 22 | validateTrade(sign, 3, ess); 23 | return true; 24 | } 25 | 26 | @Override 27 | protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException 28 | { 29 | final Trade charge = getTrade(sign, 1, 2, player, ess); 30 | final Trade money = getTrade(sign, 3, ess); 31 | charge.isAffordableFor(player); 32 | money.pay(player, OverflowType.DROP); 33 | charge.charge(player); 34 | Trade.log("Sign", "Sell", "Interact", username, charge, username, money, sign.getBlock().getLocation(), ess); 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | import com.earth2me.essentials.*; 4 | import java.util.List; 5 | import net.ess3.api.IEssentials; 6 | 7 | 8 | public class SignSpawnmob extends EssentialsSign 9 | { 10 | public SignSpawnmob() 11 | { 12 | super("Spawnmob"); 13 | } 14 | 15 | @Override 16 | protected boolean onSignCreate(ISign sign, User player, String username, IEssentials ess) throws SignException, ChargeException 17 | { 18 | validateInteger(sign, 1); 19 | validateTrade(sign, 3, ess); 20 | return true; 21 | } 22 | 23 | @Override 24 | protected boolean onSignInteract(ISign sign, User player, String username, IEssentials ess) throws SignException, ChargeException 25 | { 26 | final Trade charge = getTrade(sign, 3, ess); 27 | charge.isAffordableFor(player); 28 | 29 | try 30 | { 31 | List mobParts = SpawnMob.mobParts(sign.getLine(2)); 32 | List mobData = SpawnMob.mobData(sign.getLine(2)); 33 | SpawnMob.spawnmob(ess, ess.getServer(), player.getSource(), player, mobParts, mobData, Integer.parseInt(sign.getLine(1))); 34 | } 35 | catch (Exception ex) 36 | { 37 | throw new SignException(ex.getMessage(), ex); 38 | } 39 | 40 | charge.charge(player); 41 | Trade.log("Sign", "Spawnmob", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess); 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/signs/Signs.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.signs; 2 | 3 | //This enum is used when checking to see what signs are enabled 4 | public enum Signs 5 | { 6 | BALANCE(new SignBalance()), 7 | BUY(new SignBuy()), 8 | DISPOSAL(new SignDisposal()), 9 | ENCHANT(new SignEnchant()), 10 | FREE(new SignFree()), 11 | GAMEMODE(new SignGameMode()), 12 | HEAL(new SignHeal()), 13 | INFO(new SignInfo()), 14 | KIT(new SignKit()), 15 | MAIL(new SignMail()), 16 | PROTECTION(new SignProtection()), 17 | REPAIR(new SignRepair()), 18 | SELL(new SignSell()), 19 | SPAWNMOB(new SignSpawnmob()), 20 | TIME(new SignTime()), 21 | TRADE(new SignTrade()), 22 | WARP(new SignWarp()), 23 | WEATHER(new SignWeather()); 24 | private final EssentialsSign sign; 25 | 26 | private Signs(final EssentialsSign sign) 27 | { 28 | this.sign = sign; 29 | } 30 | 31 | public EssentialsSign getSign() 32 | { 33 | return sign; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.logging.Level; 8 | import net.ess3.api.IEssentials; 9 | import org.bukkit.Bukkit; 10 | 11 | 12 | public abstract class AbstractDelayedYamlFileReader implements Runnable 13 | { 14 | private final transient File file; 15 | private final transient Class clazz; 16 | protected final transient IEssentials plugin; 17 | 18 | public AbstractDelayedYamlFileReader(final IEssentials ess, final File file, final Class clazz) 19 | { 20 | this.file = file; 21 | this.clazz = clazz; 22 | this.plugin = ess; 23 | ess.runTaskAsynchronously(this); 24 | } 25 | 26 | public abstract void onStart(); 27 | 28 | @Override 29 | public void run() 30 | { 31 | onStart(); 32 | try 33 | { 34 | final FileReader reader = new FileReader(file); 35 | try 36 | { 37 | final T object = new YamlStorageReader(reader, plugin).load(clazz); 38 | onSuccess(object); 39 | } 40 | finally 41 | { 42 | try 43 | { 44 | reader.close(); 45 | } 46 | catch (IOException ex) 47 | { 48 | Bukkit.getLogger().log(Level.SEVERE, "File can't be closed: " + file.toString(), ex); 49 | } 50 | } 51 | 52 | } 53 | catch (FileNotFoundException ex) 54 | { 55 | onException(); 56 | if (plugin.getSettings() == null || plugin.getSettings().isDebug()) 57 | { 58 | Bukkit.getLogger().log(Level.INFO, "File not found: " + file.toString()); 59 | } 60 | } 61 | catch (ObjectLoadException ex) 62 | { 63 | onException(); 64 | Bukkit.getLogger().log(Level.SEVERE, "File broken: " + file.toString(), ex.getCause()); 65 | } 66 | } 67 | 68 | public abstract void onSuccess(T object); 69 | 70 | public abstract void onException(); 71 | } 72 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.PrintWriter; 6 | import java.util.logging.Level; 7 | import net.ess3.api.IEssentials; 8 | import org.bukkit.Bukkit; 9 | 10 | 11 | public abstract class AbstractDelayedYamlFileWriter implements Runnable 12 | { 13 | private final transient File file; 14 | 15 | public AbstractDelayedYamlFileWriter(IEssentials ess, File file) 16 | { 17 | this.file = file; 18 | ess.runTaskAsynchronously(this); 19 | } 20 | 21 | public abstract StorageObject getObject(); 22 | 23 | @Override 24 | public void run() 25 | { 26 | PrintWriter pw = null; 27 | try 28 | { 29 | final StorageObject object = getObject(); 30 | final File folder = file.getParentFile(); 31 | if (!folder.exists()) 32 | { 33 | folder.mkdirs(); 34 | } 35 | pw = new PrintWriter(file); 36 | new YamlStorageWriter(pw).save(object); 37 | } 38 | catch (FileNotFoundException ex) 39 | { 40 | Bukkit.getLogger().log(Level.SEVERE, file.toString(), ex); 41 | } 42 | finally 43 | { 44 | onFinish(); 45 | if (pw != null) 46 | { 47 | pw.close(); 48 | } 49 | } 50 | 51 | } 52 | 53 | public abstract void onFinish(); 54 | } 55 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/Comment.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.lang.annotation.*; 4 | 5 | 6 | @Target(ElementType.FIELD) 7 | @Documented 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface Comment 10 | { 11 | String[] value() default ""; 12 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.util.Map.Entry; 4 | import org.bukkit.enchantments.Enchantment; 5 | 6 | 7 | public class EnchantmentLevel implements Entry 8 | { 9 | private Enchantment enchantment; 10 | private int level; 11 | 12 | public EnchantmentLevel(final Enchantment enchantment, final int level) 13 | { 14 | this.enchantment = enchantment; 15 | this.level = level; 16 | } 17 | 18 | public Enchantment getEnchantment() 19 | { 20 | return enchantment; 21 | } 22 | 23 | public void setEnchantment(final Enchantment enchantment) 24 | { 25 | this.enchantment = enchantment; 26 | } 27 | 28 | public int getLevel() 29 | { 30 | return level; 31 | } 32 | 33 | public void setLevel(final int level) 34 | { 35 | this.level = level; 36 | } 37 | 38 | @Override 39 | public Enchantment getKey() 40 | { 41 | return enchantment; 42 | } 43 | 44 | @Override 45 | public Integer getValue() 46 | { 47 | return level; 48 | } 49 | 50 | @Override 51 | public Integer setValue(final Integer v) 52 | { 53 | int t = level; 54 | level = v; 55 | return t; 56 | } 57 | 58 | @Override 59 | public int hashCode() 60 | { 61 | return enchantment.hashCode() ^ level; 62 | } 63 | 64 | @Override 65 | public boolean equals(final Object obj) 66 | { 67 | if (obj instanceof Entry) 68 | { 69 | final Entry entry = (Entry)obj; 70 | if (entry.getKey() instanceof Enchantment 71 | && entry.getValue() instanceof Integer) 72 | { 73 | final Enchantment enchant = (Enchantment)entry.getKey(); 74 | final Integer lvl = (Integer)entry.getValue(); 75 | return this.enchantment.equals(enchant) && this.level == lvl.intValue(); 76 | } 77 | } 78 | return false; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | 4 | public interface IStorageObjectHolder 5 | { 6 | T getData(); 7 | 8 | void acquireReadLock(); 9 | 10 | void acquireWriteLock(); 11 | 12 | void close(); 13 | 14 | void unlock(); 15 | } 16 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/IStorageReader.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | 4 | public interface IStorageReader 5 | { 6 | T load(final Class clazz) throws ObjectLoadException; 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/IStorageWriter.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | 4 | public interface IStorageWriter 5 | { 6 | void save(final StorageObject object); 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/ListType.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.FIELD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface ListType 12 | { 13 | Class value() default String.class; 14 | } 15 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/MapKeyType.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.FIELD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface MapKeyType 12 | { 13 | Class value() default String.class; 14 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/MapValueType.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.FIELD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface MapValueType 12 | { 13 | Class value() default String.class; 14 | } -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/ObjectLoadException.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | 4 | public class ObjectLoadException extends Exception 5 | { 6 | public ObjectLoadException(Throwable thrwbl) 7 | { 8 | super(thrwbl); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/storage/StorageObject.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.storage; 2 | 3 | 4 | public interface StorageObject 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/textreader/IText.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.textreader; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | 7 | public interface IText 8 | { 9 | // Contains the raw text lines 10 | List getLines(); 11 | 12 | // Chapters contain the names that are displayed automatically if the file doesn't contain a introduction chapter. 13 | List getChapters(); 14 | 15 | // Bookmarks contains the string mappings from 'chapters' to line numbers. 16 | Map getBookmarks(); 17 | } 18 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.textreader; 2 | 3 | import java.util.*; 4 | 5 | 6 | public class SimpleTextInput implements IText 7 | { 8 | private final transient List lines = new ArrayList(); 9 | 10 | public SimpleTextInput(final String input) 11 | { 12 | lines.addAll(Arrays.asList(input.split("\\n"))); 13 | } 14 | 15 | public SimpleTextInput(final List input) 16 | { 17 | lines.addAll(input); 18 | } 19 | 20 | public SimpleTextInput() 21 | { 22 | } 23 | 24 | @Override 25 | public List getLines() 26 | { 27 | return lines; 28 | } 29 | 30 | @Override 31 | public List getChapters() 32 | { 33 | return Collections.emptyList(); 34 | } 35 | 36 | @Override 37 | public Map getBookmarks() 38 | { 39 | return Collections.emptyMap(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.textreader; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import java.util.List; 5 | 6 | public class SimpleTextPager 7 | { 8 | private final transient IText text; 9 | 10 | public SimpleTextPager(final IText text) 11 | { 12 | this.text = text; 13 | } 14 | 15 | public void showPage(final CommandSource sender) 16 | { 17 | for (String line : text.getLines()) 18 | { 19 | sender.sendMessage(line); 20 | } 21 | } 22 | 23 | public List getLines() 24 | { 25 | return text.getLines(); 26 | } 27 | 28 | public String getLine(int line) 29 | { 30 | if (text.getLines().size() < line) 31 | { 32 | return null; 33 | } 34 | return text.getLines().get(line); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Essentials/src/com/earth2me/essentials/utils/NumberUtil.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.utils; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import java.math.BigDecimal; 5 | import java.math.RoundingMode; 6 | import java.text.DecimalFormat; 7 | import java.text.DecimalFormatSymbols; 8 | import java.util.Locale; 9 | import net.ess3.api.IEssentials; 10 | 11 | 12 | public class NumberUtil 13 | { 14 | static DecimalFormat twoDPlaces = new DecimalFormat("#,###.##"); 15 | static DecimalFormat currencyFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US)); 16 | 17 | public static String shortCurrency(final BigDecimal value, final IEssentials ess) 18 | { 19 | return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value); 20 | } 21 | 22 | public static String formatDouble(final double value) 23 | { 24 | twoDPlaces.setRoundingMode(RoundingMode.HALF_UP); 25 | return twoDPlaces.format(value); 26 | } 27 | 28 | public static String formatAsCurrency(final BigDecimal value) 29 | { 30 | currencyFormat.setRoundingMode(RoundingMode.FLOOR); 31 | String str = currencyFormat.format(value); 32 | if (str.endsWith(".00")) 33 | { 34 | str = str.substring(0, str.length() - 3); 35 | } 36 | return str; 37 | } 38 | 39 | public static String displayCurrency(final BigDecimal value, final IEssentials ess) 40 | { 41 | return tl("currency", ess.getSettings().getCurrencySymbol(), formatAsCurrency(value)); 42 | } 43 | 44 | public static boolean isInt(final String sInt) 45 | { 46 | try 47 | { 48 | Integer.parseInt(sInt); 49 | } 50 | catch (NumberFormatException e) 51 | { 52 | return false; 53 | } 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Essentials/src/custom.txt: -------------------------------------------------------------------------------- 1 | #Customtext 2 | &6This is the custom text commands file. 3 | 4 | &6This file allows you to define custom text commands. 5 | 6 | &6You can create a specific file for a user or a group: 7 | &6Name it custom_username.txt or custom_groupname.txt 8 | 9 | &6You can use multiple pages, for example type: 10 | &c/customtext 2 11 | 12 | &6To add a custom command you need to do three things: 13 | &e-&9 Add a section below in the custom.txt 14 | &e-&9 Add a line to the commands.yml aliases section 15 | &e-&9 Give players access to 'essentials.customtext' 16 | 17 | To add /vote, add this to commands.yml: 18 | vote: 19 | - customtext vote $1- 20 | 21 | &6The following commands can also be customized: 22 | &c/rules /motd /news /help 23 | 24 | &6These support chapter customization such as:&c /rules grief 25 | &6You can use custom aliases with these commands too. 26 | 27 | #vote 28 | If you add the correct alias to commands.yml 29 | This text here will be shown if you type /vote 30 | 31 | #stafflist,onlinestaff 32 | &6Online Staff: 33 | {PLAYERLIST:MODERATOR} {PLAYERLIST:ADMIN} {PLAYERLIST:OWNER} -------------------------------------------------------------------------------- /Essentials/src/info.txt: -------------------------------------------------------------------------------- 1 | This is the info file. 2 | 3 | This file format works with the following files: 4 | info.txt, motd.txt, help.txt, custom.txt and rules.txt 5 | 6 | You can create a specific file for a user or a group: 7 | Name it info_username.txt or info_groupname.txt 8 | 9 | This also works with the other files. 10 | 11 | Extra pages: 12 | Type /info Colors 13 | Type /info Tags 14 | 15 | If you have problem viewing this file ingame, try using /einfo. 16 | If this works, it means another command is blocking /info. 17 | 18 | It can contain chapters like the Chapter1 below: 19 | 20 | #Chapter1 21 | Lines starting with # begin a new chapter 22 | The user has to type /info Chapter1 to read this chapter 23 | 24 | If the file starts with a # then the user is shown a chapter selection, 25 | when he does not select a chapter. 26 | 27 | #Colors 28 | Minecraft colors: 29 | &0 &&0 &1 &&1 &2 &&2 &3 &&3 30 | &4 &&4 &5 &&5 &6 &&6 &7 &&7 31 | &8 &&8 &9 &&9 &a &&a &b &&b 32 | &c &&c &d &&d &e &&e &f &&f 33 | &0 34 | &&k &kMagic&r &&l &lBold 35 | &&m &mStrike&r &&n &nUline 36 | &&o &oItalic&r &&r &rReset 37 | 38 | #Tags 39 | &6Player's Display name:&r {PLAYER} 40 | &6Player's user name:&r {USERNAME} 41 | &6IP:&r {IP} 42 | &6Address:&r {ADDRESS} 43 | &6Balance:&r {BALANCE} 44 | &6Unread mails:&r {MAILS} 45 | &6Current world:&r {WORLD} 46 | &6Worlds list:&r {WORLDS} 47 | &6Number of online players:&r {ONLINE} 48 | &6Number of unique players who joined the server:&r {UNIQUE} 49 | &6Player list:&r {PLAYERLIST} 50 | &6Time of server:&r {TIME} 51 | &6Date of server:&r {DATE} 52 | &6Time of world PM/AM:&r {WORLDTIME12} 53 | &6Time of world:&r {WORLDTIME24} 54 | &6Date of world:&r {WORLDDATE} 55 | &6Plugin list:&r {PLUGINS} 56 | &6Version of CraftBukkit:&r {VERSION} 57 | -------------------------------------------------------------------------------- /Essentials/src/motd.txt: -------------------------------------------------------------------------------- 1 | &6Welcome, {PLAYER}&6! 2 | &6Type &c/help&6 for a list of commands. 3 | &6Type &c/list&6 to see who else is online. 4 | &6Players online:&c {ONLINE} &6- World time:&c {WORLDTIME12} -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/Economy.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public class Economy extends com.earth2me.essentials.api.Economy 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IEssentials.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | public interface IEssentials extends com.earth2me.essentials.IEssentials 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/II18n.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface II18n extends com.earth2me.essentials.api.II18n 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IItemDb.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface IItemDb extends com.earth2me.essentials.api.IItemDb 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IJails.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface IJails extends com.earth2me.essentials.api.IJails 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IReload.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface IReload extends com.earth2me.essentials.api.IReload 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/ISettings.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface ISettings extends com.earth2me.essentials.ISettings 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/ITeleport.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface ITeleport extends com.earth2me.essentials.api.ITeleport 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IUser.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | 5 | public interface IUser extends com.earth2me.essentials.IUser 6 | { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/IWarps.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public interface IWarps extends com.earth2me.essentials.api.IWarps 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/InvalidNameException.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | 4 | public class InvalidNameException extends Exception 5 | { 6 | /** 7 | * NOTE: This is not implemented yet, just here for future 3.x api support 8 | * Allow serialization of the InvalidNameException exception 9 | */ 10 | private static final long serialVersionUID = 1485321420293663139L; 11 | 12 | public InvalidNameException(Throwable thrwbl) 13 | { 14 | super(thrwbl); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/InvalidWorldException.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class InvalidWorldException extends Exception 7 | { 8 | private final String world; 9 | 10 | public InvalidWorldException(final String world) 11 | { 12 | super(tl("invalidWorld")); 13 | this.world = world; 14 | } 15 | 16 | public String getWorld() 17 | { 18 | return this.world; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/MaxMoneyException.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class MaxMoneyException extends Exception 7 | { 8 | public MaxMoneyException() 9 | { 10 | super(tl("maxMoney")); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/NoLoanPermittedException.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class NoLoanPermittedException extends Exception 7 | { 8 | public NoLoanPermittedException() 9 | { 10 | super(tl("negativeBalanceError")); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/UserDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | 5 | 6 | public class UserDoesNotExistException extends Exception 7 | { 8 | public UserDoesNotExistException(String name) 9 | { 10 | super(tl("userDoesNotExist", name)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/AfkStatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | 5 | 6 | public class AfkStatusChangeEvent extends StatusChangeEvent 7 | { 8 | public AfkStatusChangeEvent(IUser affected, boolean value) 9 | { 10 | super(affected, affected, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/GodStatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | 5 | 6 | public class GodStatusChangeEvent extends StatusChangeEvent 7 | { 8 | public GodStatusChangeEvent(IUser affected, IUser controller, boolean value) 9 | { 10 | super(affected, controller, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/IgnoreStatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | 5 | 6 | public class IgnoreStatusChangeEvent extends StatusChangeEvent 7 | { 8 | public IgnoreStatusChangeEvent(IUser affected, IUser controller, boolean value) 9 | { 10 | super(affected, controller, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/JailStatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | 5 | 6 | public class JailStatusChangeEvent extends StatusChangeEvent 7 | { 8 | public JailStatusChangeEvent(IUser affected, IUser controller, boolean value) 9 | { 10 | super(affected, controller, value); 11 | } 12 | } -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/MuteStatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | 5 | 6 | public class MuteStatusChangeEvent extends StatusChangeEvent 7 | { 8 | public MuteStatusChangeEvent(IUser affected, IUser controller, boolean value) 9 | { 10 | super(affected, controller, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/NickChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | import org.bukkit.event.Cancellable; 5 | 6 | 7 | public class NickChangeEvent extends StateChangeEvent implements Cancellable 8 | { 9 | private String newValue; 10 | 11 | public NickChangeEvent(IUser affected, IUser controller, String value) 12 | { 13 | super(affected, controller); 14 | this.newValue = value; 15 | } 16 | 17 | public String getValue() 18 | { 19 | return newValue; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/SignBreakEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import com.earth2me.essentials.signs.EssentialsSign; 4 | import net.ess3.api.IUser; 5 | 6 | 7 | public class SignBreakEvent extends SignEvent 8 | { 9 | public SignBreakEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) 10 | { 11 | super(sign, essSign, user); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/SignCreateEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import com.earth2me.essentials.signs.EssentialsSign; 4 | import net.ess3.api.IUser; 5 | 6 | 7 | public class SignCreateEvent extends SignEvent 8 | { 9 | public SignCreateEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) 10 | { 11 | super(sign, essSign, user); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/SignEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import com.earth2me.essentials.signs.EssentialsSign; 4 | import com.earth2me.essentials.signs.EssentialsSign.ISign; 5 | import net.ess3.api.IUser; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.Event; 8 | import org.bukkit.event.HandlerList; 9 | 10 | 11 | /** 12 | * This handles common boilerplate for other SignEvent 13 | * 14 | */ 15 | public class SignEvent extends Event implements Cancellable 16 | { 17 | private static final HandlerList handlers = new HandlerList(); 18 | private boolean cancelled = false; 19 | ISign sign; 20 | EssentialsSign essSign; 21 | IUser user; 22 | 23 | public SignEvent(final ISign sign, final EssentialsSign essSign, final IUser user) 24 | { 25 | super(); 26 | this.sign = sign; 27 | this.essSign = essSign; 28 | this.user = user; 29 | } 30 | 31 | public ISign getSign() 32 | { 33 | return sign; 34 | } 35 | 36 | public EssentialsSign getEssentialsSign() 37 | { 38 | return essSign; 39 | } 40 | 41 | public IUser getUser() 42 | { 43 | return user; 44 | } 45 | 46 | @Override 47 | public HandlerList getHandlers() 48 | { 49 | return handlers; 50 | } 51 | 52 | public static HandlerList getHandlerList() 53 | { 54 | return handlers; 55 | } 56 | 57 | @Override 58 | public boolean isCancelled() 59 | { 60 | return cancelled; 61 | } 62 | 63 | @Override 64 | public void setCancelled(boolean cancelled) 65 | { 66 | this.cancelled = cancelled; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/SignInteractEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import com.earth2me.essentials.signs.EssentialsSign; 4 | import net.ess3.api.IUser; 5 | 6 | 7 | public class SignInteractEvent extends SignEvent 8 | { 9 | public SignInteractEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) 10 | { 11 | super(sign, essSign, user); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/StateChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | import org.bukkit.event.Cancellable; 5 | import org.bukkit.event.Event; 6 | import org.bukkit.event.HandlerList; 7 | 8 | 9 | /** 10 | * This handles common boilerplate for other StateChangeEvents 11 | * 12 | */ 13 | public class StateChangeEvent extends Event implements Cancellable 14 | { 15 | private static final HandlerList handlers = new HandlerList(); 16 | private boolean cancelled = false; 17 | IUser affected; 18 | IUser controller; 19 | 20 | public StateChangeEvent(IUser affected, IUser controller) 21 | { 22 | super(); 23 | this.affected = affected; 24 | this.controller = controller; 25 | } 26 | 27 | public StateChangeEvent(boolean isAsync, IUser affected, IUser controller) 28 | { 29 | super(isAsync); 30 | this.affected = affected; 31 | this.controller = controller; 32 | } 33 | 34 | public IUser getAffected() 35 | { 36 | return this.affected; 37 | } 38 | 39 | public IUser getController() 40 | { 41 | return controller; 42 | } 43 | 44 | @Override 45 | public HandlerList getHandlers() 46 | { 47 | return handlers; 48 | } 49 | 50 | public static HandlerList getHandlerList() 51 | { 52 | return handlers; 53 | } 54 | 55 | @Override 56 | public boolean isCancelled() 57 | { 58 | return cancelled; 59 | } 60 | 61 | @Override 62 | public void setCancelled(boolean cancelled) 63 | { 64 | this.cancelled = cancelled; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/StatusChangeEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import net.ess3.api.IUser; 4 | import org.bukkit.event.Cancellable; 5 | 6 | 7 | /** 8 | * This handles common boilerplate for other StatusChangeEvents 9 | * 10 | */ 11 | public class StatusChangeEvent extends StateChangeEvent implements Cancellable 12 | { 13 | private boolean newValue; 14 | 15 | public StatusChangeEvent(IUser affected, IUser controller, boolean value) 16 | { 17 | super(affected, controller); 18 | this.newValue = value; 19 | } 20 | 21 | public StatusChangeEvent(boolean isAsync, IUser affected, IUser controller, boolean value) 22 | { 23 | super(isAsync, affected, controller); 24 | this.newValue = value; 25 | } 26 | 27 | public boolean getValue() 28 | { 29 | return newValue; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Essentials/src/net/ess3/api/events/UserBalanceUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package net.ess3.api.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Event; 7 | import org.bukkit.event.HandlerList; 8 | 9 | 10 | public class UserBalanceUpdateEvent extends Event 11 | { 12 | private static final HandlerList handlers = new HandlerList(); 13 | private final Player player; 14 | private final BigDecimal originalBalance; 15 | private final BigDecimal balance; 16 | 17 | public UserBalanceUpdateEvent(Player player, BigDecimal originalBalance, BigDecimal balance) 18 | { 19 | this.player = player; 20 | this.originalBalance = originalBalance; 21 | this.balance = balance; 22 | } 23 | 24 | @Override 25 | public HandlerList getHandlers() 26 | { 27 | return handlers; 28 | } 29 | 30 | public static HandlerList getHandlerList() 31 | { 32 | return handlers; 33 | } 34 | 35 | public Player getPlayer() 36 | { 37 | return player; 38 | } 39 | 40 | public BigDecimal getNewBalance() 41 | { 42 | return balance; 43 | } 44 | 45 | public BigDecimal getOldBalance() 46 | { 47 | return originalBalance; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Essentials/src/rules.txt: -------------------------------------------------------------------------------- 1 | [1] Be respectful 2 | [2] Be ethical 3 | [3] Use common sense -------------------------------------------------------------------------------- /Essentials/test/com/earth2me/essentials/StorageTest.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials; 2 | 3 | import java.io.IOException; 4 | import junit.framework.TestCase; 5 | import org.bukkit.Location; 6 | import org.bukkit.World; 7 | import org.bukkit.World.Environment; 8 | import org.bukkit.plugin.InvalidDescriptionException; 9 | import org.junit.Test; 10 | 11 | 12 | public class StorageTest extends TestCase 13 | { 14 | Essentials ess; 15 | FakeServer server; 16 | World world; 17 | 18 | public StorageTest() 19 | { 20 | server = new FakeServer(); 21 | world = server.createWorld("testWorld", Environment.NORMAL); 22 | ess = new Essentials(server); 23 | try 24 | { 25 | ess.setupForTesting(server); 26 | } 27 | catch (InvalidDescriptionException ex) 28 | { 29 | fail("InvalidDescriptionException"); 30 | } 31 | catch (IOException ex) 32 | { 33 | fail("IOException"); 34 | } 35 | } 36 | 37 | @Test 38 | public void testOldUserdata() 39 | { 40 | ExecuteTimer ext = new ExecuteTimer(); 41 | ext.start(); 42 | OfflinePlayer base1 = server.createPlayer("testPlayer1"); 43 | server.addPlayer(base1); 44 | ext.mark("fake user created"); 45 | UserData user = (UserData)ess.getUser(base1); 46 | ext.mark("load empty user"); 47 | for (int j = 0; j < 1; j++) 48 | { 49 | user.setHome("home", new Location(world, j, j, j)); 50 | } 51 | ext.mark("change home 1 times"); 52 | user.save(); 53 | ext.mark("write user"); 54 | user.save(); 55 | ext.mark("write user (cached)"); 56 | user.reloadConfig(); 57 | ext.mark("reloaded file"); 58 | user.reloadConfig(); 59 | ext.mark("reloaded file (cached)"); 60 | System.out.println(ext.end()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /EssentialsAntiBuild/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | net.ess3 8 | EssentialsParent 9 | 2.x-SNAPSHOT 10 | 11 | 12 | EssentialsAntiBuild 13 | 14 | http://ess3.net/ 15 | 16 | 17 | Essentials Team 18 | http://ess3.net/ 19 | 20 | 21 | 22 | 23 | GPLv3 24 | http://www.gnu.org/copyleft/gpl.html 25 | 26 | 27 | 28 | 29 | scm:git:https://github.com/essentials/Essentials.git 30 | scm:git:https://github.com/essentials/Essentials.git 31 | https://github.com/essentials/Essentials 32 | 33 | 34 | 35 | JIRA 36 | http://essentials3.atlassian.net 37 | 38 | 39 | 40 | TeamCity 41 | http://ci.ess3.net/ 42 | 43 | 44 | 45 | 46 | net.ess3 47 | Essentials 48 | ${project.version} 49 | 50 | 51 | -------------------------------------------------------------------------------- /EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.antibuild; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import org.bukkit.plugin.Plugin; 6 | 7 | 8 | public interface IAntiBuild extends Plugin 9 | { 10 | boolean checkProtectionItems(final AntiBuildConfig list, final int id); 11 | 12 | boolean getSettingBool(final AntiBuildConfig protectConfig); 13 | 14 | EssentialsConnect getEssentialsConnect(); 15 | 16 | Map getSettingsBoolean(); 17 | 18 | Map> getSettingsList(); 19 | } 20 | -------------------------------------------------------------------------------- /EssentialsAntiBuild/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsAntiBuild 3 | main: com.earth2me.essentials.antibuild.EssentialsAntiBuild 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://tiny.cc/EssentialsCommands 7 | description: Provides build protection. 8 | authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally] 9 | depend: [Essentials] 10 | -------------------------------------------------------------------------------- /EssentialsChat/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | net.ess3 8 | EssentialsParent 9 | 2.x-SNAPSHOT 10 | 11 | 12 | EssentialsChat 13 | 14 | http://ess3.net/ 15 | 16 | 17 | Essentials Team 18 | http://ess3.net/ 19 | 20 | 21 | 22 | 23 | GPLv3 24 | http://www.gnu.org/copyleft/gpl.html 25 | 26 | 27 | 28 | 29 | scm:git:https://github.com/essentials/Essentials.git 30 | scm:git:https://github.com/essentials/Essentials.git 31 | https://github.com/essentials/Essentials 32 | 33 | 34 | 35 | JIRA 36 | http://essentials3.atlassian.net 37 | 38 | 39 | 40 | TeamCity 41 | http://ci.ess3.net/ 42 | 43 | 44 | 45 | 46 | net.ess3 47 | Essentials 48 | ${project.version} 49 | 50 | 51 | -------------------------------------------------------------------------------- /EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.chat; 2 | 3 | import com.earth2me.essentials.Trade; 4 | import com.earth2me.essentials.User; 5 | import net.ess3.api.IEssentials; 6 | 7 | 8 | public class ChatStore 9 | { 10 | private final User user; 11 | private final String type; 12 | private final Trade charge; 13 | private long radius; 14 | 15 | ChatStore(final IEssentials ess, final User user, final String type) 16 | { 17 | this.user = user; 18 | this.type = type; 19 | this.charge = new Trade(getLongType(), ess); 20 | } 21 | 22 | public User getUser() 23 | { 24 | return user; 25 | } 26 | 27 | public Trade getCharge() 28 | { 29 | return charge; 30 | } 31 | 32 | public String getType() 33 | { 34 | return type; 35 | } 36 | 37 | public final String getLongType() 38 | { 39 | return type.length() == 0 ? "chat" : "chat-" + type; 40 | } 41 | 42 | public long getRadius() 43 | { 44 | return radius; 45 | } 46 | 47 | public void setRadius(long radius) 48 | { 49 | this.radius = radius; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.chat; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import net.ess3.api.IEssentials; 5 | import java.util.Collections; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | import java.util.logging.Level; 9 | import java.util.logging.Logger; 10 | import org.bukkit.event.player.AsyncPlayerChatEvent; 11 | import org.bukkit.plugin.PluginManager; 12 | import org.bukkit.plugin.java.JavaPlugin; 13 | 14 | 15 | public class EssentialsChat extends JavaPlugin 16 | { 17 | private static final Logger LOGGER = Logger.getLogger("Minecraft"); 18 | 19 | @Override 20 | public void onEnable() 21 | { 22 | final PluginManager pluginManager = getServer().getPluginManager(); 23 | final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials"); 24 | if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) 25 | { 26 | LOGGER.log(Level.WARNING, tl("versionMismatchAll")); 27 | } 28 | if (!ess.isEnabled()) 29 | { 30 | this.setEnabled(false); 31 | return; 32 | } 33 | 34 | final Map chatStore = Collections.synchronizedMap(new HashMap()); 35 | 36 | final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore); 37 | final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore); 38 | final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore); 39 | pluginManager.registerEvents(playerListenerLowest, this); 40 | pluginManager.registerEvents(playerListenerNormal, this); 41 | pluginManager.registerEvents(playerListenerHighest, this); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.chat; 2 | 3 | import net.ess3.api.IEssentials; 4 | import java.util.Map; 5 | import org.bukkit.Server; 6 | import org.bukkit.event.EventHandler; 7 | import org.bukkit.event.EventPriority; 8 | import org.bukkit.event.player.AsyncPlayerChatEvent; 9 | 10 | 11 | public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer 12 | { 13 | public EssentialsChatPlayerListenerHighest(final Server server, 14 | final IEssentials ess, 15 | final Map chatStorage) 16 | { 17 | super(server, ess, chatStorage); 18 | } 19 | 20 | @EventHandler(priority = EventPriority.HIGHEST) 21 | @Override 22 | public void onPlayerChat(final AsyncPlayerChatEvent event) 23 | { 24 | final ChatStore chatStore = delChatStore(event); 25 | if (isAborted(event) || chatStore == null) 26 | { 27 | return; 28 | } 29 | 30 | /** 31 | * This file should handle charging the user for the action before returning control back 32 | */ 33 | charge(event, chatStore); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /EssentialsChat/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsChat 3 | main: com.earth2me.essentials.chat.EssentialsChat 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://tiny.cc/EssentialsCommands 7 | description: Provides chat control features for Essentials. Requires Permissions. 8 | authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy, Iaccidentally] 9 | depend: [Essentials] 10 | #softdepend: [Factions] -------------------------------------------------------------------------------- /EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.geoip; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import net.ess3.api.IEssentials; 5 | import java.util.logging.Level; 6 | import org.bukkit.plugin.PluginManager; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | 10 | public class EssentialsGeoIP extends JavaPlugin 11 | { 12 | public EssentialsGeoIP() 13 | { 14 | } 15 | 16 | @Override 17 | public void onDisable() 18 | { 19 | } 20 | 21 | @Override 22 | public void onEnable() 23 | { 24 | final PluginManager pm = getServer().getPluginManager(); 25 | final IEssentials ess = (IEssentials)pm.getPlugin("Essentials"); 26 | if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) 27 | { 28 | getLogger().log(Level.WARNING, tl("versionMismatchAll")); 29 | } 30 | if (!ess.isEnabled()) { 31 | this.setEnabled(false); 32 | return; 33 | } 34 | final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess); 35 | pm.registerEvents(playerListener, this); 36 | 37 | 38 | getLogger().log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /EssentialsGeoIP/src/config.yml: -------------------------------------------------------------------------------- 1 | database: 2 | show-cities: false 3 | download-if-missing: true 4 | # Url for country 5 | download-url: "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" 6 | # Url for cities 7 | download-url-city: "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" 8 | 9 | show-on-login: true 10 | show-on-whois: true -------------------------------------------------------------------------------- /EssentialsGeoIP/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsGeoIP 3 | main: com.earth2me.essentials.geoip.EssentialsGeoIP 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://tiny.cc/EssentialsCommands 7 | description: Shows the country or city of a user on login and /whois. 8 | authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] 9 | depend: [Essentials] -------------------------------------------------------------------------------- /EssentialsGroupManager/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EssentialsGroupManager/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | EssentialsGroupManager 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.ui.externaltools.ExternalToolBuilder 15 | full,incremental, 16 | 17 | 18 | LaunchConfigHandle 19 | <project>/.externalToolBuilders/GroupManager_Builder.launch 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | 27 | 28 | -------------------------------------------------------------------------------- /EssentialsGroupManager/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=a6709b83 2 | build.xml.script.CRC32=5b346364 3 | build.xml.stylesheet.CRC32=28e38971@1.38.2.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=a6709b83 7 | nbproject/build-impl.xml.script.CRC32=e5c840ec 8 | nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 9 | -------------------------------------------------------------------------------- /EssentialsGroupManager/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EssentialsGroupManager 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/groups.yml: -------------------------------------------------------------------------------- 1 | # Group inheritance 2 | # 3 | # Any inherited groups prefixed with a g: are global groups 4 | # and are inherited from the GlobalGroups.yml. 5 | # 6 | # Groups without the g: prefix are groups local to this world 7 | # and are defined in the this groups.yml file. 8 | # 9 | # Local group inheritances define your promotion tree when using 'manpromote/mandemote' 10 | 11 | groups: 12 | Default: 13 | default: true 14 | permissions: 15 | - -bukkit.command.kill 16 | inheritance: 17 | - g:groupmanager_default 18 | - g:bukkit_default 19 | - g:essentials_default 20 | - g:towny_default 21 | info: 22 | prefix: '&e' 23 | build: false 24 | suffix: '' 25 | Builder: 26 | default: false 27 | permissions: [] 28 | inheritance: 29 | - default 30 | - g:essentials_builder 31 | - g:towny_builder 32 | info: 33 | prefix: '&2' 34 | build: true 35 | suffix: '' 36 | Moderator: 37 | default: false 38 | permissions: [] 39 | inheritance: 40 | - builder 41 | - g:groupmanager_moderator 42 | - g:bukkit_moderator 43 | - g:essentials_moderator 44 | - g:towny_moderator 45 | - g:vanish_moderator 46 | info: 47 | prefix: '&5' 48 | build: true 49 | suffix: '' 50 | Admin: 51 | default: false 52 | permissions: [] 53 | inheritance: 54 | - moderator 55 | - g:groupmanager_admin 56 | - g:bukkit_admin 57 | - g:essentials_admin 58 | - g:towny_admin 59 | - g:vanish_admin 60 | info: 61 | prefix: '&c' 62 | build: true 63 | suffix: '' 64 | Owner: 65 | default: false 66 | permissions: 67 | - '*' 68 | - -vanish.* 69 | inheritance: 70 | - admin 71 | info: 72 | prefix: '&4' 73 | build: true 74 | suffix: '' 75 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java: -------------------------------------------------------------------------------- 1 | package org.anjocaido.groupmanager.Tasks; 2 | 3 | import org.anjocaido.groupmanager.GroupManager; 4 | 5 | /* 6 | * 7 | * Created by ElgarL 8 | */ 9 | 10 | public class BukkitPermsUpdateTask implements Runnable { 11 | 12 | public BukkitPermsUpdateTask() { 13 | 14 | super(); 15 | } 16 | 17 | @Override 18 | public void run() { 19 | 20 | // Signal loaded and update BukkitPermissions. 21 | GroupManager.setLoaded(true); 22 | GroupManager.BukkitPermissions.collectPermissions(); 23 | GroupManager.BukkitPermissions.updateAllPlayers(); 24 | 25 | GroupManager.logger.info("Bukkit Permissions Updated!"); 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.anjocaido.groupmanager.data; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 11 | * @author gabrielcouto 12 | */ 13 | public class UserVariables extends Variables { 14 | 15 | private User owner; 16 | 17 | public UserVariables(User owner) { 18 | 19 | super(owner); 20 | this.owner = owner; 21 | } 22 | 23 | public UserVariables(User owner, Map varList) { 24 | 25 | super(owner); 26 | this.variables.clear(); 27 | this.variables.putAll(varList); 28 | this.owner = owner; 29 | } 30 | 31 | /** 32 | * A clone of all vars here. 33 | * 34 | * @return UserVariables clone 35 | */ 36 | protected UserVariables clone(User newOwner) { 37 | 38 | UserVariables clone = new UserVariables(newOwner); 39 | synchronized(variables) { 40 | for (String key : variables.keySet()) { 41 | clone.variables.put(key, variables.get(key)); 42 | } 43 | } 44 | newOwner.flagAsChanged(); 45 | return clone; 46 | } 47 | 48 | /** 49 | * @return the owner 50 | */ 51 | @Override 52 | public User getOwner() { 53 | 54 | return owner; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java: -------------------------------------------------------------------------------- 1 | package org.anjocaido.groupmanager.events; 2 | 3 | import org.anjocaido.groupmanager.GroupManager; 4 | import org.bukkit.event.Event; 5 | import org.bukkit.event.HandlerList; 6 | 7 | /** 8 | * @author ElgarL 9 | * 10 | */ 11 | public class GMSystemEvent extends Event { 12 | 13 | /** 14 | * 15 | */ 16 | private static final HandlerList handlers = new HandlerList(); 17 | 18 | @Override 19 | public HandlerList getHandlers() { 20 | 21 | return handlers; 22 | } 23 | 24 | public static HandlerList getHandlerList() { 25 | 26 | return handlers; 27 | } 28 | 29 | ////////////////////////////// 30 | 31 | protected Action action; 32 | 33 | public GMSystemEvent(Action action) { 34 | 35 | super(); 36 | 37 | this.action = action; 38 | } 39 | 40 | public Action getAction() { 41 | 42 | return this.action; 43 | } 44 | 45 | public enum Action { 46 | RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE, 47 | } 48 | 49 | public void schedule(final GMSystemEvent event) { 50 | 51 | synchronized (GroupManager.getGMEventHandler().getServer()) { 52 | if (GroupManager.getGMEventHandler().getServer().getScheduler().scheduleSyncDelayedTask(GroupManager.getGMEventHandler().getPlugin(), new Runnable() { 53 | 54 | @Override 55 | public void run() { 56 | 57 | GroupManager.getGMEventHandler().getServer().getPluginManager().callEvent(event); 58 | } 59 | }, 1) == -1) 60 | GroupManager.logger.warning("Could not schedule GM Event."); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.anjocaido.groupmanager.utils; 6 | 7 | import java.util.logging.ConsoleHandler; 8 | import java.util.logging.Level; 9 | import java.util.logging.LogRecord; 10 | 11 | /** 12 | * 13 | * @author gabrielcouto 14 | */ 15 | public class GMLoggerHandler extends ConsoleHandler { 16 | 17 | @Override 18 | public void publish(LogRecord record) { 19 | 20 | String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage(); 21 | if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) { 22 | System.err.println(message); 23 | } else { 24 | System.out.println(message); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.anjocaido.groupmanager.utils; 6 | 7 | /** 8 | * Just a list of commands for this plugin 9 | * 10 | * @author gabrielcouto 11 | */ 12 | public enum GroupManagerPermissions { 13 | 14 | manuadd, 15 | manudel, 16 | manuaddsub, 17 | manudelsub, 18 | mangadd, 19 | mangdel, 20 | manuaddp, 21 | manudelp, 22 | manuclearp, 23 | manulistp, 24 | manucheckp, 25 | mangaddp, 26 | mangdelp, 27 | mangclearp, 28 | manglistp, 29 | mangcheckp, 30 | mangaddi, 31 | mangdeli, 32 | manuaddv, 33 | manudelv, 34 | manulistv, 35 | manucheckv, 36 | mangaddv, 37 | mangdelv, 38 | manglistv, 39 | mangcheckv, 40 | manwhois, 41 | tempadd, 42 | tempdel, 43 | templist, 44 | tempdelall, 45 | mansave, 46 | manload, 47 | listgroups, 48 | manpromote, 49 | mandemote, 50 | mantogglevalidate, 51 | mantogglesave, 52 | manworld, 53 | manselect, 54 | manclear, 55 | mancheckw 56 | } 57 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.anjocaido.groupmanager.utils; 6 | 7 | import org.anjocaido.groupmanager.data.DataUnit; 8 | 9 | /** 10 | * 11 | * @author gabrielcouto 12 | */ 13 | public class PermissionCheckResult { 14 | 15 | /** 16 | * It should be the owner of the access level found. 17 | * 18 | * Use instanceof to find the owner type 19 | */ 20 | public DataUnit owner; 21 | /** 22 | * The permission node found in the DataUnit. 23 | */ 24 | public String accessLevel; 25 | /** 26 | * The full name of the permission you are looking for 27 | */ 28 | public String askedPermission; 29 | /** 30 | * The result conclusion of the search. 31 | * It determines if the owner can do, or not. 32 | * 33 | * It even determines if it has an owner. 34 | */ 35 | public Type resultType = Type.NOTFOUND; 36 | 37 | /** 38 | * The type of result the search can give. 39 | */ 40 | public enum Type { 41 | 42 | /** 43 | * If found a matching node starting with '+'. 44 | * It means the user CAN do the permission. 45 | */ 46 | EXCEPTION, 47 | /** 48 | * If found a matching node starting with '-'. 49 | * It means the user CANNOT do the permission. 50 | */ 51 | NEGATION, 52 | /** 53 | * If just found a common matching node. 54 | * IT means the user CAN do the permission. 55 | */ 56 | FOUND, 57 | /** 58 | * If no matchin node was found. 59 | * It means the user CANNOT do the permission. 60 | * 61 | * owner field and accessLevel field should not be considered, 62 | * when type is 63 | * NOTFOUND 64 | */ 65 | NOTFOUND 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.anjocaido.groupmanager.utils; 6 | 7 | import java.util.Comparator; 8 | 9 | /** 10 | * 11 | * @author gabrielcouto 12 | */ 13 | public class StringPermissionComparator implements Comparator { 14 | 15 | @Override 16 | public int compare(String permA, String permB) { 17 | 18 | boolean ap = permA.startsWith("+"); 19 | boolean bp = permB.startsWith("+"); 20 | boolean am = permA.startsWith("-"); 21 | boolean bm = permB.startsWith("-"); 22 | if (ap && bp) { 23 | return 0; 24 | } 25 | if (ap && !bp) { 26 | return -1; 27 | } 28 | if (!ap && bp) { 29 | return 1; 30 | } 31 | if (am && bm) { 32 | return 0; 33 | } 34 | if (am && !bm) { 35 | return -1; 36 | } 37 | if (!am && bm) { 38 | return 1; 39 | } 40 | return permA.compareToIgnoreCase(permB); 41 | } 42 | 43 | private static StringPermissionComparator instance; 44 | 45 | public static StringPermissionComparator getInstance() { 46 | 47 | if (instance == null) { 48 | instance = new StringPermissionComparator(); 49 | } 50 | return instance; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /EssentialsGroupManager/src/users.yml: -------------------------------------------------------------------------------- 1 | # "For a more advanced configuration example utilizing the advanced features of GroupManager, see http://pastebin.com/a8ZA0j5G" 2 | users: 3 | snowleo: 4 | group: Builder 5 | subgroups: [] 6 | permissions: 7 | - groupmanager.noofflineperms 8 | KHobbits: 9 | group: Moderator 10 | subgroups: [] 11 | permissions: 12 | - groupmanager.noofflineperms 13 | ElgarL: 14 | group: Moderator 15 | subgroups: [] 16 | permissions: 17 | - groupmanager.noofflineperms 18 | 19 | -------------------------------------------------------------------------------- /EssentialsProtect/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | net.ess3 8 | EssentialsParent 9 | 2.x-SNAPSHOT 10 | 11 | 12 | EssentialsProtect 13 | 14 | http://ess3.net/ 15 | 16 | 17 | Essentials Team 18 | http://ess3.net/ 19 | 20 | 21 | 22 | 23 | GPLv3 24 | http://www.gnu.org/copyleft/gpl.html 25 | 26 | 27 | 28 | 29 | scm:git:https://github.com/essentials/Essentials.git 30 | scm:git:https://github.com/essentials/Essentials.git 31 | https://github.com/essentials/Essentials 32 | 33 | 34 | 35 | JIRA 36 | http://essentials3.atlassian.net 37 | 38 | 39 | 40 | TeamCity 41 | http://ci.ess3.net/ 42 | 43 | 44 | 45 | 46 | net.ess3 47 | Essentials 48 | ${project.version} 49 | 50 | 51 | -------------------------------------------------------------------------------- /EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.protect; 2 | 3 | import org.bukkit.event.EventHandler; 4 | import org.bukkit.event.EventPriority; 5 | import org.bukkit.event.Listener; 6 | import org.bukkit.event.block.BlockBreakEvent; 7 | import org.bukkit.event.block.BlockBurnEvent; 8 | import org.bukkit.event.block.BlockFromToEvent; 9 | import org.bukkit.event.block.BlockIgniteEvent; 10 | import org.bukkit.event.entity.EntityDamageEvent; 11 | import org.bukkit.event.entity.EntityExplodeEvent; 12 | import org.bukkit.event.player.PlayerJoinEvent; 13 | 14 | 15 | public class EmergencyListener implements Listener 16 | { 17 | @EventHandler(priority = EventPriority.LOW) 18 | public void onBlockBurn(final BlockBurnEvent event) 19 | { 20 | event.setCancelled(true); 21 | } 22 | 23 | @EventHandler(priority = EventPriority.LOW) 24 | public void onBlockIgnite(final BlockIgniteEvent event) 25 | { 26 | event.setCancelled(true); 27 | } 28 | 29 | @EventHandler(priority = EventPriority.LOW) 30 | public void onBlockFromTo(final BlockFromToEvent event) 31 | { 32 | event.setCancelled(true); 33 | } 34 | 35 | @EventHandler(priority = EventPriority.LOW) 36 | public void onBlockBreak(final BlockBreakEvent event) 37 | { 38 | event.setCancelled(true); 39 | } 40 | 41 | @EventHandler(priority = EventPriority.LOW) 42 | public void onPlayerJoin(final PlayerJoinEvent event) 43 | { 44 | event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors."); 45 | } 46 | 47 | @EventHandler(priority = EventPriority.LOW) 48 | public void onEntityExplode(final EntityExplodeEvent event) 49 | { 50 | event.setCancelled(true); 51 | } 52 | 53 | @EventHandler(priority = EventPriority.LOW) 54 | public void onEntityDamage(final EntityDamageEvent event) 55 | { 56 | event.setCancelled(true); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.protect; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.IConf; 5 | import net.ess3.api.IEssentials; 6 | import java.util.logging.Level; 7 | import java.util.logging.Logger; 8 | import org.bukkit.plugin.Plugin; 9 | 10 | 11 | public class EssentialsConnect 12 | { 13 | private static final Logger LOGGER = Logger.getLogger("Minecraft"); 14 | private final IEssentials ess; 15 | private final IProtect protect; 16 | 17 | public EssentialsConnect(Plugin essPlugin, Plugin essProtect) 18 | { 19 | if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) 20 | { 21 | LOGGER.log(Level.WARNING, tl("versionMismatchAll")); 22 | } 23 | ess = (IEssentials)essPlugin; 24 | protect = (IProtect)essProtect; 25 | ProtectReloader pr = new ProtectReloader(); 26 | pr.reloadConfig(); 27 | ess.addReloadListener(pr); 28 | } 29 | 30 | public IEssentials getEssentials() 31 | { 32 | return ess; 33 | } 34 | 35 | private class ProtectReloader implements IConf 36 | { 37 | @Override 38 | public void reloadConfig() 39 | { 40 | for (ProtectConfig protectConfig : ProtectConfig.values()) 41 | { 42 | if (protectConfig.isList()) 43 | { 44 | protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); 45 | } 46 | else if (protectConfig.isString()) 47 | { 48 | protect.getSettingsString().put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); 49 | } 50 | else 51 | { 52 | protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); 53 | } 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.protect; 2 | 3 | import org.bukkit.event.EventHandler; 4 | import org.bukkit.event.EventPriority; 5 | import org.bukkit.event.Listener; 6 | import org.bukkit.event.weather.LightningStrikeEvent; 7 | import org.bukkit.event.weather.ThunderChangeEvent; 8 | import org.bukkit.event.weather.WeatherChangeEvent; 9 | 10 | 11 | public class EssentialsProtectWeatherListener implements Listener 12 | { 13 | private final IProtect prot; 14 | 15 | public EssentialsProtectWeatherListener(final IProtect prot) 16 | { 17 | this.prot = prot; 18 | } 19 | 20 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) 21 | public void onWeatherChange(final WeatherChangeEvent event) 22 | { 23 | if (prot.getSettingBool(ProtectConfig.disable_weather_storm) 24 | && event.toWeatherState()) 25 | { 26 | event.setCancelled(true); 27 | } 28 | } 29 | 30 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) 31 | public void onLightningStrike(final LightningStrikeEvent event) 32 | { 33 | if (prot.getSettingBool(ProtectConfig.disable_weather_lightning)) 34 | { 35 | event.setCancelled(true); 36 | } 37 | } 38 | 39 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) 40 | public void onThunderChange(final ThunderChangeEvent event) 41 | { 42 | if (prot.getSettingBool(ProtectConfig.disable_weather_thunder) 43 | && event.toThunderState()) 44 | { 45 | event.setCancelled(true); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.protect; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import org.bukkit.plugin.Plugin; 6 | 7 | 8 | public interface IProtect extends Plugin 9 | { 10 | boolean getSettingBool(final ProtectConfig protectConfig); 11 | 12 | String getSettingString(final ProtectConfig protectConfig); 13 | 14 | EssentialsConnect getEssentialsConnect(); 15 | 16 | Map getSettingsBoolean(); 17 | 18 | Map getSettingsString(); 19 | 20 | Map> getSettingsList(); 21 | } 22 | -------------------------------------------------------------------------------- /EssentialsProtect/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsProtect 3 | main: com.earth2me.essentials.protect.EssentialsProtect 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://tiny.cc/EssentialsCommands 7 | description: Provides protection for various parts of the world. 8 | authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] 9 | softdepend: [Essentials] -------------------------------------------------------------------------------- /EssentialsSpawn/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | net.ess3 8 | EssentialsParent 9 | 2.x-SNAPSHOT 10 | 11 | 12 | EssentialsSpawn 13 | 14 | http://ess3.net/ 15 | 16 | 17 | Essentials Team 18 | http://ess3.net/ 19 | 20 | 21 | 22 | 23 | GPLv3 24 | http://www.gnu.org/copyleft/gpl.html 25 | 26 | 27 | 28 | 29 | scm:git:https://github.com/essentials/Essentials.git 30 | scm:git:https://github.com/essentials/Essentials.git 31 | https://github.com/essentials/Essentials 32 | 33 | 34 | 35 | JIRA 36 | http://essentials3.atlassian.net 37 | 38 | 39 | 40 | TeamCity 41 | http://ci.ess3.net/ 42 | 43 | 44 | 45 | 46 | net.ess3 47 | Essentials 48 | ${project.version} 49 | 50 | 51 | -------------------------------------------------------------------------------- /EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.spawn; 2 | 3 | import static com.earth2me.essentials.I18n.tl; 4 | import com.earth2me.essentials.User; 5 | import com.earth2me.essentials.commands.EssentialsCommand; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandsetspawn extends EssentialsCommand 10 | { 11 | public Commandsetspawn() 12 | { 13 | super("setspawn"); 14 | } 15 | 16 | @Override 17 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 18 | { 19 | final String group = args.length > 0 ? getFinalArg(args, 0) : "default"; 20 | ((SpawnStorage)module).setSpawn(user.getLocation(), group); 21 | user.sendMessage(tl("spawnSet", group)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /EssentialsSpawn/src/com/earth2me/essentials/spawn/IEssentialsSpawn.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.spawn; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.plugin.Plugin; 5 | 6 | 7 | public interface IEssentialsSpawn extends Plugin 8 | { 9 | 10 | /** 11 | * Sets the spawn for a given group to a given location. 12 | * 13 | * @param loc The location to set the spawn to 14 | * @param group The group to set the spawn of, or 'default' for the default spawn 15 | * @throws IllegalArgumentException If group is null 16 | */ 17 | public void setSpawn(Location loc, String group); 18 | 19 | /** 20 | * Gets the spawn location for a given group. 21 | * 22 | * @param group The group to get the spawn of, or 'default' for the default spawn 23 | * @return The spawn location set for the given group 24 | * @throws IllegalArgumentException If group is null 25 | */ 26 | public Location getSpawn(String group); 27 | } 28 | -------------------------------------------------------------------------------- /EssentialsSpawn/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsSpawn 3 | main: com.earth2me.essentials.spawn.EssentialsSpawn 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://tiny.cc/EssentialsCommands 7 | description: Provides spawn control commands, utilizing Essentials. 8 | authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] 9 | depend: [Essentials] 10 | commands: 11 | setspawn: 12 | description: Set the spawnpoint to your current position. 13 | usage: / 14 | aliases: [esetspawn] 15 | spawn: 16 | description: Teleport to the spawnpoint. 17 | usage: / [player] 18 | aliases: [espawn] -------------------------------------------------------------------------------- /EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.xmpp; 2 | 3 | import com.earth2me.essentials.User; 4 | import com.earth2me.essentials.commands.EssentialsCommand; 5 | import com.earth2me.essentials.commands.NotEnoughArgumentsException; 6 | import org.bukkit.Server; 7 | 8 | 9 | public class Commandsetxmpp extends EssentialsCommand 10 | { 11 | public Commandsetxmpp() 12 | { 13 | super("setxmpp"); 14 | } 15 | 16 | @Override 17 | protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException 18 | { 19 | if (args.length < 1) 20 | { 21 | throw new NotEnoughArgumentsException(); 22 | } 23 | 24 | EssentialsXMPP.getInstance().setAddress(user.getBase(), args[0]); 25 | user.sendMessage("XMPP address set to " + args[0]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.xmpp; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.Console; 5 | import com.earth2me.essentials.commands.EssentialsCommand; 6 | import com.earth2me.essentials.commands.NotEnoughArgumentsException; 7 | import org.bukkit.Server; 8 | 9 | 10 | public class Commandxmpp extends EssentialsCommand 11 | { 12 | public Commandxmpp() 13 | { 14 | super("xmpp"); 15 | } 16 | 17 | @Override 18 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException 19 | { 20 | if (args.length < 2) 21 | { 22 | throw new NotEnoughArgumentsException(); 23 | } 24 | 25 | final String address = EssentialsXMPP.getInstance().getAddress(args[0]); 26 | if (address == null) 27 | { 28 | sender.sendMessage("§cThere are no players matching that name."); 29 | } 30 | else 31 | { 32 | final String message = getFinalArg(args, 1); 33 | final String senderName = sender.isPlayer() ? ess.getUser(sender.getPlayer()).getDisplayName() : Console.NAME; 34 | sender.sendMessage("[" + senderName + ">" + address + "] " + message); 35 | if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message)) 36 | { 37 | sender.sendMessage("§cError sending message."); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.xmpp; 2 | 3 | import com.earth2me.essentials.CommandSource; 4 | import com.earth2me.essentials.commands.EssentialsCommand; 5 | import com.earth2me.essentials.commands.NotEnoughArgumentsException; 6 | import java.util.List; 7 | import org.bukkit.Server; 8 | import org.bukkit.entity.Player; 9 | 10 | 11 | public class Commandxmppspy extends EssentialsCommand 12 | { 13 | public Commandxmppspy() 14 | { 15 | super("xmppspy"); 16 | } 17 | 18 | @Override 19 | protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException 20 | { 21 | if (args.length < 1) 22 | { 23 | throw new NotEnoughArgumentsException(); 24 | } 25 | 26 | final List matches = server.matchPlayer(args[0]); 27 | 28 | if (matches.isEmpty()) 29 | { 30 | sender.sendMessage("§cThere are no players matching that name."); 31 | } 32 | 33 | for (Player p : matches) 34 | { 35 | try 36 | { 37 | final boolean toggle = EssentialsXMPP.getInstance().toggleSpy(p); 38 | sender.sendMessage("XMPP Spy " + (toggle ? "enabled" : "disabled") + " for " + p.getDisplayName()); 39 | } 40 | catch (Exception ex) 41 | { 42 | sender.sendMessage("Error: " + ex.getMessage()); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java: -------------------------------------------------------------------------------- 1 | package com.earth2me.essentials.xmpp; 2 | 3 | import com.earth2me.essentials.IEssentials; 4 | import net.ess3.api.IUser; 5 | import java.util.List; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | 10 | public interface IEssentialsXMPP extends Plugin 11 | { 12 | String getAddress(final Player user); 13 | 14 | String getAddress(final String name); 15 | 16 | List getSpyUsers(); 17 | 18 | IUser getUserByAddress(final String address); 19 | 20 | boolean sendMessage(final Player user, final String message); 21 | 22 | boolean sendMessage(final String address, final String message); 23 | 24 | void setAddress(final Player user, final String address); 25 | 26 | boolean toggleSpy(final Player user); 27 | 28 | void broadcastMessage(final IUser sender, final String message, final String xmppAddress); 29 | 30 | IEssentials getEss(); 31 | } 32 | -------------------------------------------------------------------------------- /EssentialsXMPP/src/config.yml: -------------------------------------------------------------------------------- 1 | xmpp: 2 | server: 'example.com' 3 | user: 'name@example.com' 4 | password: 'password' 5 | # servicename: 'example.com' 6 | # port: 5222 7 | # sasl-enabled: false 8 | 9 | debug: false 10 | 11 | op-users: 12 | # - 'name@example.com' 13 | 14 | 15 | log-enabled: false 16 | # Level is minimum level that should be send: info, warning, severe 17 | log-level: warning 18 | log-users: 19 | # - 'name@example.com' -------------------------------------------------------------------------------- /EssentialsXMPP/src/plugin.yml: -------------------------------------------------------------------------------- 1 | # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) 2 | name: EssentialsXMPP 3 | main: com.earth2me.essentials.xmpp.EssentialsXMPP 4 | # Note to developers: This next line cannot change, or the automatic versioning system will break. 5 | version: TeamCity 6 | website: http://ess.khhq.net/wiki/XMPP 7 | description: Provides xmpp communication. 8 | authors: 9 | - snowleo 10 | depend: [Essentials] 11 | commands: 12 | setxmpp: 13 | description: set your xmpp address 14 | usage: /
15 | xmpp: 16 | description: send a message to a player 17 | usage: / 18 | xmppspy: 19 | description: toggle xmpp spy for all messages 20 | usage: / -------------------------------------------------------------------------------- /WebPush/apikey.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /WebPush/index.php: -------------------------------------------------------------------------------- 1 | 59 | 60 | -------------------------------------------------------------------------------- /WebPush/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | copy.src.files=false 2 | copy.src.target= 3 | index.file=index.php 4 | remote.connection=localhost-d13e79 5 | remote.directory=/upload 6 | remote.upload=ON_SAVE 7 | run.as=REMOTE 8 | url=http://ess.khhq.net/upload/ 9 | -------------------------------------------------------------------------------- /WebPush/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | include.path=${php.global.include.path} 2 | php.version=PHP_5 3 | source.encoding=UTF-8 4 | src.dir=. 5 | tags.asp=false 6 | tags.short=true 7 | web.root=. 8 | -------------------------------------------------------------------------------- /groupmanager-pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | net.ess3 8 | EssentialsParent 9 | 2.x-SNAPSHOT 10 | 11 | 12 | EssentialsGroupManager 13 | 14 | http://ess3.net/ 15 | 16 | 17 | Essentials Team 18 | http://ess3.net/ 19 | 20 | 21 | 22 | 23 | GPLv3 24 | http://www.gnu.org/copyleft/gpl.html 25 | 26 | 27 | 28 | 29 | scm:git:https://github.com/essentials/Essentials.git 30 | scm:git:https://github.com/essentials/Essentials.git 31 | https://github.com/essentials/Essentials 32 | 33 | 34 | 35 | JIRA 36 | http://essentials3.atlassian.net 37 | 38 | 39 | 40 | TeamCity 41 | http://ci.ess3.net/ 42 | 43 | -------------------------------------------------------------------------------- /lib/BOSEconomy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/BOSEconomy.jar -------------------------------------------------------------------------------- /lib/MultiCurrency.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/MultiCurrency.jar -------------------------------------------------------------------------------- /lib/PermissionsBukkit.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/PermissionsBukkit.jar -------------------------------------------------------------------------------- /lib/PermissionsEx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/PermissionsEx.jar -------------------------------------------------------------------------------- /lib/Privileges.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/Privileges.jar -------------------------------------------------------------------------------- /lib/SimplyPerms.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/SimplyPerms.jar -------------------------------------------------------------------------------- /lib/bukkit.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/bukkit.jar -------------------------------------------------------------------------------- /lib/iCo5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/iCo5.jar -------------------------------------------------------------------------------- /lib/iCo6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/iCo6.jar -------------------------------------------------------------------------------- /lib/zPermissions.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpigotMC/Essentials/4a4a71b811215eca26d561f93348ecd3135c475f/lib/zPermissions.jar -------------------------------------------------------------------------------- /nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | build-with-dependencies 5 | also-make 6 | 7 | package 8 | dependency:copy 9 | 10 | 11 | 12 | 13 | 14 | 15 | rebuild 16 | 17 | clean 18 | package 19 | dependency:copy 20 | 21 | 22 | 23 | build 24 | 25 | package 26 | dependency:copy 27 | 28 | 29 | 30 | --------------------------------------------------------------------------------