Trying to find out why drop item isnt loading
This commit is contained in:
parent
187f02068e
commit
9760a1da4d
26
.classpath
Normal file
26
.classpath
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
/bin
|
||||
/target
|
||||
.classpath
|
||||
.project
|
@ -1,58 +0,0 @@
|
||||
!SESSION 2012-06-01 20:37:35.859 -----------------------------------------------
|
||||
eclipse.buildId=I20120518-2145
|
||||
java.version=1.6.0_31
|
||||
java.vendor=Sun Microsystems Inc.
|
||||
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
|
||||
Command-line arguments: -os win32 -ws win32 -arch x86 -data C:\Documents and Settings\Charles\.ssh\Blacksmith
|
||||
|
||||
!ENTRY org.eclipse.help.base 4 0 2012-06-01 20:39:24.500
|
||||
!MESSAGE An error occured while pre-processing help XHTML document "/org.eclipse.platform.doc.user/whatsNew/platform_whatsnew.html" for search indexing
|
||||
!STACK 0
|
||||
org.xml.sax.SAXParseException: Attribute name "allowfullscreen" associated with an element type "iframe" must be followed by the ' = ' character.
|
||||
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
|
||||
at org.eclipse.help.internal.dynamic.DocumentReader.read(DocumentReader.java:56)
|
||||
at org.eclipse.help.internal.dynamic.XMLProcessor.process(XMLProcessor.java:49)
|
||||
at org.eclipse.help.internal.xhtml.DynamicXHTMLProcessor.process(DynamicXHTMLProcessor.java:76)
|
||||
at org.eclipse.help.internal.search.XHTMLSearchParticipant.preprocess(XHTMLSearchParticipant.java:106)
|
||||
at org.eclipse.help.search.SearchParticipantXML.addDocument(SearchParticipantXML.java:296)
|
||||
at org.eclipse.help.internal.search.HTMLSearchParticipant.addDocument(HTMLSearchParticipant.java:51)
|
||||
at org.eclipse.help.internal.search.SearchIndex.addDocument(SearchIndex.java:231)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.addDocuments(IndexingOperation.java:252)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.addNewDocuments(IndexingOperation.java:159)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.execute(IndexingOperation.java:106)
|
||||
at org.eclipse.help.internal.search.LocalSearchManager.updateIndex(LocalSearchManager.java:671)
|
||||
at org.eclipse.help.internal.search.LocalSearchManager.ensureIndexUpdated(LocalSearchManager.java:645)
|
||||
at org.eclipse.help.internal.search.federated.IndexerJob.run(IndexerJob.java:31)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
||||
|
||||
!ENTRY org.eclipse.help.base 4 4 2012-06-01 20:39:24.593
|
||||
!MESSAGE Help documentation could not be indexed completely.
|
||||
!SUBENTRY 1 org.eclipse.help.base 4 4 2012-06-01 20:39:24.593
|
||||
!MESSAGE Exception occurred while adding document /org.eclipse.platform.doc.user/whatsNew/platform_whatsnew.html to index.
|
||||
!STACK 0
|
||||
org.xml.sax.SAXParseException: Premature end of file.
|
||||
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
|
||||
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
|
||||
at javax.xml.parsers.SAXParser.parse(Unknown Source)
|
||||
at javax.xml.parsers.SAXParser.parse(Unknown Source)
|
||||
at org.eclipse.help.search.SearchParticipantXML.addDocument(SearchParticipantXML.java:297)
|
||||
at org.eclipse.help.internal.search.HTMLSearchParticipant.addDocument(HTMLSearchParticipant.java:51)
|
||||
at org.eclipse.help.internal.search.SearchIndex.addDocument(SearchIndex.java:231)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.addDocuments(IndexingOperation.java:252)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.addNewDocuments(IndexingOperation.java:159)
|
||||
at org.eclipse.help.internal.search.IndexingOperation.execute(IndexingOperation.java:106)
|
||||
at org.eclipse.help.internal.search.LocalSearchManager.updateIndex(LocalSearchManager.java:671)
|
||||
at org.eclipse.help.internal.search.LocalSearchManager.ensureIndexUpdated(LocalSearchManager.java:645)
|
||||
at org.eclipse.help.internal.search.federated.IndexerJob.run(IndexerJob.java:31)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
@ -1 +0,0 @@
|
||||
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
version=1
|
@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<launchPerspectives/>\r\n
|
||||
preferredTargets=default\:default|
|
@ -1,8 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1338593897765" defaultVMConnector\="">\r\n<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">\r\n<vm id\="1338593897765" name\="jre6" path\="C\:\\Program Files\\Java\\jre6"/>\r\n</vmType>\r\n</vmSettings>\r\n
|
@ -1,18 +0,0 @@
|
||||
content_assist_number_of_computers=13
|
||||
content_assist_proposals_background=255,255,255
|
||||
content_assist_proposals_foreground=0,0,0
|
||||
eclipse.preferences.version=1
|
||||
fontPropagated=true
|
||||
org.eclipse.jdt.ui.editor.tab.width=
|
||||
org.eclipse.jdt.ui.formatterprofiles.version=12
|
||||
org.eclipse.jdt.ui.javadoclocations.migrated=true
|
||||
org.eclipse.jdt.ui.text.code_templates_migrated=true
|
||||
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
|
||||
org.eclipse.jdt.ui.text.custom_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
|
||||
org.eclipse.jdt.ui.text.templates_migrated=true
|
||||
org.eclipse.jface.textfont=1|Courier New|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Courier New;
|
||||
proposalOrderMigrated=true
|
||||
spelling_locale_initialized=true
|
||||
tabWidthPropagated=true
|
||||
useAnnotationsPrefPage=true
|
||||
useQuickDiffPrefPage=true
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.search.defaultPerspective=org.eclipse.search.defaultPerspective.none
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
pref_first_startup=false
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.team.ui.first_time=false
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
overviewRuler_migration=migrated_3.1
|
@ -1,5 +0,0 @@
|
||||
PROBLEMS_FILTERS_MIGRATE=true
|
||||
eclipse.preferences.version=1
|
||||
platformState=1338379144146
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
showIntro=false
|
@ -1,2 +0,0 @@
|
||||
ENABLED_DECORATORS=org.eclipse.jdt.ui.override.decorator\:true,org.eclipse.jdt.ui.interface.decorator\:false,org.eclipse.jdt.ui.buildpath.decorator\:true,org.eclipse.pde.ui.binaryProjectDecorator\:false,org.eclipse.team.cvs.ui.decorator\:true,org.eclipse.ui.LinkedResourceDecorator\:true,org.eclipse.ui.VirtualResourceDecorator\:true,org.eclipse.ui.ContentTypeDecorator\:true,org.eclipse.ui.ResourceFilterDecorator\:false,
|
||||
eclipse.preferences.version=1
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.debug.ui.SELECT_LAUNCH_SHORTCUT_DIALOG">
|
||||
<item value="223" key="DIALOG_WIDTH"/>
|
||||
<item value="415" key="DIALOG_HEIGHT"/>
|
||||
<item value="1|Tahoma|8.25|0|WINDOWS|1|-11|0|0|0|400|0|0|0|1|0|0|0|0|Tahoma" key="DIALOG_FONT_NAME"/>
|
||||
</section>
|
||||
</section>
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.equinox.internal.p2.ui.dialogs.InstallWizard.WizardSettings">
|
||||
<item value="614" key="DIALOG_WIDTH"/>
|
||||
<item value="99" key="DIALOG_Y_ORIGIN"/>
|
||||
<item value="645" key="DIALOG_HEIGHT"/>
|
||||
<item value="537" key="DIALOG_X_ORIGIN"/>
|
||||
<item value="1|Tahoma|8.25|0|WINDOWS|1|-11|0|0|0|400|0|0|0|1|0|0|0|0|Tahoma" key="DIALOG_FONT_NAME"/>
|
||||
</section>
|
||||
</section>
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
INDEX VERSION 1.126
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
java
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
INDEX VERSION 1.126+C:\Documents and Settings\Charles\.ssh\Blacksmith\.metadata\.plugins\org.eclipse.jdt.core
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<dirs>
|
||||
<entry loc="C:\Program Files\Java\jre6" stamp="1333742811825"/>
|
||||
</dirs>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<libraryInfos>
|
||||
<libraryInfo home="C:\Program Files\Java\jre6" version="1.6.0_31">
|
||||
<bootpath>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\resources.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\rt.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\sunrsasign.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\jsse.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\jce.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\charsets.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\modules\jdk.boot.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre6\classes"/>
|
||||
</bootpath>
|
||||
<extensionDirs>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\ext"/>
|
||||
<entry path="C:\WINDOWS\Sun\Java\lib\ext"/>
|
||||
</extensionDirs>
|
||||
<endorsedDirs>
|
||||
<entry path="C:\Program Files\Java\jre6\lib\endorsed"/>
|
||||
</endorsedDirs>
|
||||
</libraryInfo>
|
||||
</libraryInfos>
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<typeInfoHistroy/>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<qualifiedTypeNameHistroy>
|
||||
<fullyQualifiedTypeName name="net.apunch.blacksmith.BlacksmithPlugin"/>
|
||||
</qualifiedTypeNameHistroy>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<item value="filter_imports;" key="filters_last_used"/>
|
||||
<item value="C:\Documents and Settings\Charles\Desktop\eclipse" key="org.eclipse.jdt.ui.lastextjar"/>
|
||||
<section name="OptionalMessageDialog.hide.">
|
||||
<item value="true" key="org.eclipse.jdt.ui.typecomment.deprecated"/>
|
||||
</section>
|
||||
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
|
||||
<item value="true" key="group_libraries"/>
|
||||
<item value="false" key="linkWithEditor"/>
|
||||
<item value="2" key="layout"/>
|
||||
<item value="1" key="rootMode"/>
|
||||
<item value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1338593796984">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.pde.ui.ExternalPluginLibrariesFilter1" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.pde.ui.BinaryProjectFilter1" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>" key="memento"/>
|
||||
</section>
|
||||
<section name="completion_proposal_size">
|
||||
</section>
|
||||
<section name="JavaElementSearchActions">
|
||||
</section>
|
||||
<section name="BuildPathsPropertyPage">
|
||||
<item value="3" key="pageIndex"/>
|
||||
</section>
|
||||
<section name="NewClassWizardPage">
|
||||
<item value="false" key="create_constructor"/>
|
||||
<item value="true" key="create_unimplemented"/>
|
||||
<item value="false" key="create_main"/>
|
||||
</section>
|
||||
<section name="quick_assist_proposal_size">
|
||||
</section>
|
||||
<section name="ClasspathContainerSelectionPage">
|
||||
<item value="0" key="index"/>
|
||||
</section>
|
||||
</section>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<session version="1.0">
|
||||
<refactoring comment="Delete resource 'Blacksmith'" deleteContents="true" description="Delete resource 'Blacksmith'" element1="/Blacksmith" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1338601019687"/>
|
||||
</session>
|
@ -1 +0,0 @@
|
||||
1338601019687 Delete resource 'Blacksmith'
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="RefactoringWizard.preview">
|
||||
<item value="400" key="height"/>
|
||||
<item value="600" key="width"/>
|
||||
</section>
|
||||
</section>
|
@ -1,2 +0,0 @@
|
||||
#Cached timestamps
|
||||
#Fri Jun 01 20:56:46 EDT 2012
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.jdt.ui.JavaSearchResultPage">
|
||||
<item value="TRUE" key="org.eclipse.jdt.search.resultpage.limit_enabled"/>
|
||||
<item value="1000" key="org.eclipse.jdt.search.resultpage.limit"/>
|
||||
</section>
|
||||
<section name="">
|
||||
<item value="TRUE" key="org.eclipse.jdt.search.resultpage.limit_enabled"/>
|
||||
<item value="1000" key="org.eclipse.jdt.search.resultpage.limit"/>
|
||||
</section>
|
||||
</section>
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CommitCommentTemplates></CommitCommentTemplates>
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CommitComments></CommitComments>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="NewLocationWizard">
|
||||
</section>
|
||||
</section>
|
@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<repositories-view>
|
||||
</repositories-view>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="ChooseWorkspaceDialogSettings">
|
||||
<item value="222" key="DIALOG_Y_ORIGIN"/>
|
||||
<item value="214" key="DIALOG_X_ORIGIN"/>
|
||||
</section>
|
||||
<section name="ExternalProjectImportWizard">
|
||||
</section>
|
||||
<section name="WORKBENCH_SETTINGS">
|
||||
<list key="ENABLED_TRANSFERS">
|
||||
</list>
|
||||
</section>
|
||||
</section>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<item value="1024" key="introLaunchBar.location"/>
|
||||
</section>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="FileSystemImportWizard">
|
||||
<item value="true" key="WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"/>
|
||||
<item value="false" key="WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID"/>
|
||||
<list key="WizardFileSystemResourceImportPage1.STORE_SOURCE_NAMES_ID">
|
||||
<item value="C:\Documents and Settings\Charles\.ssh\Blacksmith"/>
|
||||
</list>
|
||||
</section>
|
||||
<section name="org.eclipse.ui.internal.QuickAccess">
|
||||
<item value="1440" key="dialogWidth"/>
|
||||
<item value="761" key="dialogHeight"/>
|
||||
<list key="orderedProviders">
|
||||
</list>
|
||||
<list key="textArray">
|
||||
</list>
|
||||
<list key="orderedElements">
|
||||
</list>
|
||||
<list key="textEntries">
|
||||
</list>
|
||||
</section>
|
||||
<section name="ImportExportAction">
|
||||
<item value="org.eclipse.ui.wizards.import.FileSystem" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/>
|
||||
<list key="ImportExportPage.STORE_EXPANDED_IMPORT_CATEGORIES">
|
||||
<item value="org.eclipse.ui.Basic"/>
|
||||
</list>
|
||||
</section>
|
||||
</section>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workingSetManager>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1338593796984_0" label="Window Working Set" name="Aggregate for window 1338593796984"/>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1338597462812_1" label="Window Working Set" name="Aggregate for window 1338597462812"/>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1338598612375_2" label="Window Working Set" name="Aggregate for window 1338598612375"/>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1338600176375_3" label="Window Working Set" name="Aggregate for window 1338600176375"/>
|
||||
</workingSetManager>
|
@ -1 +0,0 @@
|
||||
org.eclipse.core.runtime=1
|
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Blacksmith</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,4 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
@ -1,271 +0,0 @@
|
||||
package net.apunch.blacksmith;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.apunch.blacksmith.util.Settings.Setting;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.character.Character;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
|
||||
public class Blacksmith extends Character {
|
||||
private static final int[] enchantments = new int[Enchantment.values().length];
|
||||
|
||||
private final BlacksmithPlugin plugin;
|
||||
private final List<Material> reforgeableItems = new ArrayList<Material>();
|
||||
private final Map<String, Calendar> cooldowns = new HashMap<String, Calendar>();
|
||||
private ReforgeSession session;
|
||||
|
||||
// Defaults
|
||||
private String busyWithPlayerMsg = Setting.BUSY_WITH_PLAYER_MESSAGE.asString();
|
||||
private String busyReforgingMsg = Setting.BUSY_WITH_REFORGE_MESSAGE.asString();
|
||||
private String costMsg = Setting.COST_MESSAGE.asString();
|
||||
private String invalidItemMsg = Setting.INVALID_ITEM_MESSAGE.asString();
|
||||
private String startReforgeMsg = Setting.START_REFORGE_MESSAGE.asString();
|
||||
private String successMsg = Setting.SUCCESS_MESSAGE.asString();
|
||||
private String failMsg = Setting.FAIL_MESSAGE.asString();
|
||||
private String insufficientFundsMsg = Setting.INSUFFICIENT_FUNDS_MESSAGE.asString();
|
||||
private String cooldownUnexpiredMsg = Setting.COOLDOWN_UNEXPIRED_MESSAGE.asString();
|
||||
private String itemChangedMsg = Setting.ITEM_UNEXPECTEDLY_CHANGED_MESSAGE.asString();
|
||||
private int minReforgeDelay = Setting.MIN_REFORGE_DELAY.asInt();
|
||||
private int maxReforgeDelay = Setting.MAX_REFORGE_DELAY.asInt();
|
||||
private int reforgeCooldown = Setting.REFORGE_COOLDOWN.asInt();
|
||||
private int failChance = Setting.FAIL_CHANCE.asInt();
|
||||
private int maxEnchantments = Setting.MAX_ENCHANTMENTS.asInt();
|
||||
private boolean dropItem = Setting.DROP_ITEM.asBoolean();
|
||||
|
||||
public Blacksmith() {
|
||||
plugin = (BlacksmithPlugin) Bukkit.getServer().getPluginManager().getPlugin("Blacksmith");
|
||||
int i = 0;
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
enchantments[i++] = enchantment.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(DataKey key) {
|
||||
for (DataKey sub : key.getRelative("reforgeable-items").getIntegerSubKeys())
|
||||
if (Material.getMaterial(sub.getString("").toUpperCase().replace('-', '_')) != null)
|
||||
reforgeableItems.add(Material.getMaterial(sub.getString("").toUpperCase().replace('-', '_')));
|
||||
|
||||
// Override defaults if they exist
|
||||
if (key.keyExists("messages.busy-with-player"))
|
||||
busyWithPlayerMsg = key.getString("messages.busy-with-player");
|
||||
if (key.keyExists("messages.busy-with-reforge"))
|
||||
busyReforgingMsg = key.getString("messages.busy-with-reforge");
|
||||
if (key.keyExists("messages.cost"))
|
||||
costMsg = key.getString("messages.cost");
|
||||
if (key.keyExists("messages.invalid-item"))
|
||||
invalidItemMsg = key.getString("messages.invalid-item");
|
||||
if (key.keyExists("messages.start-reforge"))
|
||||
startReforgeMsg = key.getString("messages.start-reforge");
|
||||
if (key.keyExists("messages.successful-reforge"))
|
||||
successMsg = key.getString("messages.successful-reforge");
|
||||
if (key.keyExists("messages.fail-reforge"))
|
||||
failMsg = key.getString("messages.fail-reforge");
|
||||
if (key.keyExists("messages.insufficient-funds"))
|
||||
insufficientFundsMsg = key.getString("messages.insufficient-funds");
|
||||
if (key.keyExists("messages.cooldown-not-expired"))
|
||||
cooldownUnexpiredMsg = key.getString("messages.cooldown-not-expired");
|
||||
if (key.keyExists("messages.item-changed-during-reforge"))
|
||||
itemChangedMsg = key.getString("messages.item-changed-during-reforge");
|
||||
if (key.keyExists("delays-in-seconds.minimum"))
|
||||
minReforgeDelay = key.getInt("delays-in-seconds.minimum");
|
||||
if (key.keyExists("delays-in-seconds.maximum"))
|
||||
maxReforgeDelay = key.getInt("delays-in-seconds.maximum");
|
||||
if (key.keyExists("delays-in-seconds.reforge-cooldown"))
|
||||
reforgeCooldown = key.getInt("delays-in-seconds.reforge-cooldown");
|
||||
if (key.keyExists("percent-chance-to-fail-reforge"))
|
||||
failChance = key.getInt("percent-chance-to-fail-reforge");
|
||||
if (key.keyExists("maximum-enchantments"))
|
||||
maxEnchantments = key.getInt("maximum-enchantments");
|
||||
if (key.keyExists("drop-item"))
|
||||
dropItem = key.getBoolean("drop-item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(NPC npc, Player player) {
|
||||
if (!player.hasPermission("blacksmith.reforge"))
|
||||
return;
|
||||
|
||||
if (cooldowns.get(player.getName()) != null) {
|
||||
if (!Calendar.getInstance().after(cooldowns.get(player.getName()))) {
|
||||
npc.chat(player, cooldownUnexpiredMsg);
|
||||
return;
|
||||
}
|
||||
cooldowns.remove(player.getName());
|
||||
}
|
||||
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (session != null) {
|
||||
if (!session.isInSession(player)) {
|
||||
npc.chat(player, busyWithPlayerMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (session.isRunning()) {
|
||||
npc.chat(player, busyReforgingMsg);
|
||||
return;
|
||||
}
|
||||
if (session.handleClick())
|
||||
session = null;
|
||||
else
|
||||
reforge(npc, player);
|
||||
} else {
|
||||
if ((!plugin.isTool(hand) && !plugin.isArmor(hand))
|
||||
|| (!reforgeableItems.isEmpty() && !reforgeableItems.contains(hand.getType()))) {
|
||||
npc.chat(player, invalidItemMsg);
|
||||
return;
|
||||
}
|
||||
session = new ReforgeSession(player, npc);
|
||||
npc.chat(
|
||||
player,
|
||||
costMsg.replace("<price>", plugin.formatCost(player)).replace("<item>",
|
||||
hand.getType().name().toLowerCase().replace('_', ' ')));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(DataKey key) {
|
||||
for (int i = 0; i < reforgeableItems.size(); i++)
|
||||
key.getRelative("reforgeable-items").setString(String.valueOf(i),
|
||||
reforgeableItems.get(i).name().toLowerCase().replace('_', '-'));
|
||||
|
||||
key.setString("messages.busy-with-player", busyWithPlayerMsg);
|
||||
key.setString("messages.busy-with-reforge", busyReforgingMsg);
|
||||
key.setString("messages.cost", costMsg);
|
||||
key.setString("messages.invalid-item", invalidItemMsg);
|
||||
key.setString("messages.start-reforge", startReforgeMsg);
|
||||
key.setString("messages.successful-reforge", successMsg);
|
||||
key.setString("messages.fail-reforge", failMsg);
|
||||
key.setString("messages.insufficient-funds", insufficientFundsMsg);
|
||||
key.setString("messages.cooldown-not-expired", cooldownUnexpiredMsg);
|
||||
key.setString("messages.item-changed-during-reforge", itemChangedMsg);
|
||||
key.setInt("delays-in-seconds.minimum", minReforgeDelay);
|
||||
key.setInt("delays-in-seconds.maximum", maxReforgeDelay);
|
||||
key.setInt("delays-in-seconds.reforge-cooldown", reforgeCooldown);
|
||||
key.setInt("percent-chance-to-fail-reforge", failChance);
|
||||
key.setInt("maximum-enchantments", maxEnchantments);
|
||||
key.setBoolean("drop-item", dropItem);
|
||||
}
|
||||
|
||||
private void reforge(NPC npc, Player player) {
|
||||
npc.chat(player, startReforgeMsg);
|
||||
plugin.withdraw(player);
|
||||
session.beginReforge();
|
||||
if (npc.getBukkitEntity() instanceof Player)
|
||||
((Player) npc.getBukkitEntity()).setItemInHand(player.getItemInHand());
|
||||
player.setItemInHand(null);
|
||||
}
|
||||
|
||||
private class ReforgeSession implements Runnable {
|
||||
private final Player player;
|
||||
private final NPC npc;
|
||||
private final ItemStack reforge;
|
||||
private int taskId;
|
||||
|
||||
private ReforgeSession(Player player, NPC npc) {
|
||||
this.player = player;
|
||||
this.npc = npc;
|
||||
reforge = player.getItemInHand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
npc.chat(player, reforgeItemInHand() ? successMsg : failMsg);
|
||||
if (npc.getBukkitEntity() instanceof Player)
|
||||
((Player) npc.getBukkitEntity()).setItemInHand(null);
|
||||
if (dropItem)
|
||||
player.getWorld().dropItemNaturally(npc.getBukkitEntity().getLocation(), reforge);
|
||||
else {
|
||||
for (ItemStack stack : player.getInventory().addItem(reforge).values())
|
||||
player.getWorld().dropItemNaturally(npc.getBukkitEntity().getLocation(), stack);
|
||||
}
|
||||
session = null;
|
||||
// Start cooldown
|
||||
Calendar wait = Calendar.getInstance();
|
||||
wait.add(Calendar.SECOND, reforgeCooldown);
|
||||
cooldowns.put(player.getName(), wait);
|
||||
}
|
||||
|
||||
private boolean reforgeItemInHand() {
|
||||
Random random = new Random();
|
||||
if (random.nextInt(100) < failChance) {
|
||||
for (Enchantment enchantment : reforge.getEnchantments().keySet()) {
|
||||
// Remove or downgrade enchantments
|
||||
if (random.nextBoolean())
|
||||
reforge.removeEnchantment(enchantment);
|
||||
else {
|
||||
if (reforge.getEnchantmentLevel(enchantment) > 1) {
|
||||
reforge.removeEnchantment(enchantment);
|
||||
reforge.addEnchantment(enchantment, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Damage the item
|
||||
short durability = (short) (reforge.getDurability() + reforge.getDurability() * random.nextInt(8));
|
||||
short maxDurability = reforge.getType().getMaxDurability();
|
||||
if (durability <= 0)
|
||||
durability = (short) (maxDurability / 3);
|
||||
else if (reforge.getDurability() + durability > maxDurability)
|
||||
durability = (short) (maxDurability - random.nextInt(maxDurability - 25));
|
||||
reforge.setDurability(durability);
|
||||
return false;
|
||||
}
|
||||
// Add random enchantments
|
||||
int chance = 10;
|
||||
if (reforge.getDurability() == 0)
|
||||
chance *= 4;
|
||||
else
|
||||
reforge.setDurability((short) 0);
|
||||
for (int i = 0; i < chance; i++) {
|
||||
if (reforge.getEnchantments().keySet().size() == maxEnchantments)
|
||||
break;
|
||||
Enchantment enchantment = Enchantment.getById(enchantments[random.nextInt(enchantments.length)]);
|
||||
if (enchantment.canEnchantItem(reforge))
|
||||
reforge.addEnchantment(enchantment, random.nextInt(enchantment.getMaxLevel()) + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return if the session should end
|
||||
private boolean handleClick() {
|
||||
// Prevent player from switching items during session
|
||||
if (!reforge.equals(player.getItemInHand())) {
|
||||
npc.chat(player, itemChangedMsg);
|
||||
return true;
|
||||
}
|
||||
if (!plugin.doesPlayerHaveEnough(player)) {
|
||||
npc.chat(player, insufficientFundsMsg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isRunning() {
|
||||
return plugin.getServer().getScheduler().isQueued(taskId);
|
||||
}
|
||||
|
||||
private boolean isInSession(Player other) {
|
||||
return player.getName().equals(other.getName());
|
||||
}
|
||||
|
||||
private void beginReforge() {
|
||||
taskId = plugin
|
||||
.getServer()
|
||||
.getScheduler()
|
||||
.scheduleAsyncDelayedTask(plugin, this,
|
||||
(new Random().nextInt(maxReforgeDelay) + minReforgeDelay) * 20);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,271 +0,0 @@
|
||||
package net.instinxx.blacksmith;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.character.Character;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.instinxx.blacksmith.util.Settings.Setting;
|
||||
|
||||
public class Blacksmith extends Character {
|
||||
private static final int[] enchantments = new int[Enchantment.values().length];
|
||||
|
||||
private final BlacksmithPlugin plugin;
|
||||
private final List<Material> reforgeableItems = new ArrayList<Material>();
|
||||
private final Map<String, Calendar> cooldowns = new HashMap<String, Calendar>();
|
||||
private ReforgeSession session;
|
||||
|
||||
// Defaults
|
||||
private String busyWithPlayerMsg = Setting.BUSY_WITH_PLAYER_MESSAGE.asString();
|
||||
private String busyReforgingMsg = Setting.BUSY_WITH_REFORGE_MESSAGE.asString();
|
||||
private String costMsg = Setting.COST_MESSAGE.asString();
|
||||
private String invalidItemMsg = Setting.INVALID_ITEM_MESSAGE.asString();
|
||||
private String startReforgeMsg = Setting.START_REFORGE_MESSAGE.asString();
|
||||
private String successMsg = Setting.SUCCESS_MESSAGE.asString();
|
||||
private String failMsg = Setting.FAIL_MESSAGE.asString();
|
||||
private String insufficientFundsMsg = Setting.INSUFFICIENT_FUNDS_MESSAGE.asString();
|
||||
private String cooldownUnexpiredMsg = Setting.COOLDOWN_UNEXPIRED_MESSAGE.asString();
|
||||
private String itemChangedMsg = Setting.ITEM_UNEXPECTEDLY_CHANGED_MESSAGE.asString();
|
||||
private int minReforgeDelay = Setting.MIN_REFORGE_DELAY.asInt();
|
||||
private int maxReforgeDelay = Setting.MAX_REFORGE_DELAY.asInt();
|
||||
private int reforgeCooldown = Setting.REFORGE_COOLDOWN.asInt();
|
||||
private int failChance = Setting.FAIL_CHANCE.asInt();
|
||||
private int maxEnchantments = Setting.MAX_ENCHANTMENTS.asInt();
|
||||
private boolean dropItem = Setting.DROP_ITEM.asBoolean();
|
||||
|
||||
public Blacksmith() {
|
||||
plugin = (BlacksmithPlugin) Bukkit.getServer().getPluginManager().getPlugin("Blacksmith");
|
||||
int i = 0;
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
enchantments[i++] = enchantment.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(DataKey key) {
|
||||
for (DataKey sub : key.getRelative("reforgeable-items").getIntegerSubKeys())
|
||||
if (Material.getMaterial(sub.getString("").toUpperCase().replace('-', '_')) != null)
|
||||
reforgeableItems.add(Material.getMaterial(sub.getString("").toUpperCase().replace('-', '_')));
|
||||
|
||||
// Override defaults if they exist
|
||||
if (key.keyExists("messages.busy-with-player"))
|
||||
busyWithPlayerMsg = key.getString("messages.busy-with-player");
|
||||
if (key.keyExists("messages.busy-with-reforge"))
|
||||
busyReforgingMsg = key.getString("messages.busy-with-reforge");
|
||||
if (key.keyExists("messages.cost"))
|
||||
costMsg = key.getString("messages.cost");
|
||||
if (key.keyExists("messages.invalid-item"))
|
||||
invalidItemMsg = key.getString("messages.invalid-item");
|
||||
if (key.keyExists("messages.start-reforge"))
|
||||
startReforgeMsg = key.getString("messages.start-reforge");
|
||||
if (key.keyExists("messages.successful-reforge"))
|
||||
successMsg = key.getString("messages.successful-reforge");
|
||||
if (key.keyExists("messages.fail-reforge"))
|
||||
failMsg = key.getString("messages.fail-reforge");
|
||||
if (key.keyExists("messages.insufficient-funds"))
|
||||
insufficientFundsMsg = key.getString("messages.insufficient-funds");
|
||||
if (key.keyExists("messages.cooldown-not-expired"))
|
||||
cooldownUnexpiredMsg = key.getString("messages.cooldown-not-expired");
|
||||
if (key.keyExists("messages.item-changed-during-reforge"))
|
||||
itemChangedMsg = key.getString("messages.item-changed-during-reforge");
|
||||
if (key.keyExists("delays-in-seconds.minimum"))
|
||||
minReforgeDelay = key.getInt("delays-in-seconds.minimum");
|
||||
if (key.keyExists("delays-in-seconds.maximum"))
|
||||
maxReforgeDelay = key.getInt("delays-in-seconds.maximum");
|
||||
if (key.keyExists("delays-in-seconds.reforge-cooldown"))
|
||||
reforgeCooldown = key.getInt("delays-in-seconds.reforge-cooldown");
|
||||
if (key.keyExists("percent-chance-to-fail-reforge"))
|
||||
failChance = key.getInt("percent-chance-to-fail-reforge");
|
||||
if (key.keyExists("maximum-enchantments"))
|
||||
maxEnchantments = key.getInt("maximum-enchantments");
|
||||
if (key.keyExists("drop-item"))
|
||||
dropItem = key.getBoolean("drop-item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(NPC npc, Player player) {
|
||||
if (!player.hasPermission("blacksmith.reforge"))
|
||||
return;
|
||||
|
||||
if (cooldowns.get(player.getName()) != null) {
|
||||
if (!Calendar.getInstance().after(cooldowns.get(player.getName()))) {
|
||||
npc.chat(player, cooldownUnexpiredMsg);
|
||||
return;
|
||||
}
|
||||
cooldowns.remove(player.getName());
|
||||
}
|
||||
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (session != null) {
|
||||
if (!session.isInSession(player)) {
|
||||
npc.chat(player, busyWithPlayerMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (session.isRunning()) {
|
||||
npc.chat(player, busyReforgingMsg);
|
||||
return;
|
||||
}
|
||||
if (session.handleClick())
|
||||
session = null;
|
||||
else
|
||||
reforge(npc, player);
|
||||
} else {
|
||||
if ((!plugin.isTool(hand) && !plugin.isArmor(hand))
|
||||
|| (!reforgeableItems.isEmpty() && !reforgeableItems.contains(hand.getType()))) {
|
||||
npc.chat(player, invalidItemMsg);
|
||||
return;
|
||||
}
|
||||
session = new ReforgeSession(player, npc);
|
||||
npc.chat(
|
||||
player,
|
||||
costMsg.replace("<price>", plugin.formatCost(player)).replace("<item>",
|
||||
hand.getType().name().toLowerCase().replace('_', ' ')));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(DataKey key) {
|
||||
for (int i = 0; i < reforgeableItems.size(); i++)
|
||||
key.getRelative("reforgeable-items").setString(String.valueOf(i),
|
||||
reforgeableItems.get(i).name().toLowerCase().replace('_', '-'));
|
||||
|
||||
key.setString("messages.busy-with-player", busyWithPlayerMsg);
|
||||
key.setString("messages.busy-with-reforge", busyReforgingMsg);
|
||||
key.setString("messages.cost", costMsg);
|
||||
key.setString("messages.invalid-item", invalidItemMsg);
|
||||
key.setString("messages.start-reforge", startReforgeMsg);
|
||||
key.setString("messages.successful-reforge", successMsg);
|
||||
key.setString("messages.fail-reforge", failMsg);
|
||||
key.setString("messages.insufficient-funds", insufficientFundsMsg);
|
||||
key.setString("messages.cooldown-not-expired", cooldownUnexpiredMsg);
|
||||
key.setString("messages.item-changed-during-reforge", itemChangedMsg);
|
||||
key.setInt("delays-in-seconds.minimum", minReforgeDelay);
|
||||
key.setInt("delays-in-seconds.maximum", maxReforgeDelay);
|
||||
key.setInt("delays-in-seconds.reforge-cooldown", reforgeCooldown);
|
||||
key.setInt("percent-chance-to-fail-reforge", failChance);
|
||||
key.setInt("maximum-enchantments", maxEnchantments);
|
||||
key.setBoolean("drop-item", dropItem);
|
||||
}
|
||||
|
||||
private void reforge(NPC npc, Player player) {
|
||||
npc.chat(player, startReforgeMsg);
|
||||
plugin.withdraw(player);
|
||||
session.beginReforge();
|
||||
if (npc.getBukkitEntity() instanceof Player)
|
||||
((Player) npc.getBukkitEntity()).setItemInHand(player.getItemInHand());
|
||||
player.setItemInHand(null);
|
||||
}
|
||||
|
||||
private class ReforgeSession implements Runnable {
|
||||
private final Player player;
|
||||
private final NPC npc;
|
||||
private final ItemStack reforge;
|
||||
private int taskId;
|
||||
|
||||
private ReforgeSession(Player player, NPC npc) {
|
||||
this.player = player;
|
||||
this.npc = npc;
|
||||
reforge = player.getItemInHand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
npc.chat(player, reforgeItemInHand() ? successMsg : failMsg);
|
||||
if (npc.getBukkitEntity() instanceof Player)
|
||||
((Player) npc.getBukkitEntity()).setItemInHand(null);
|
||||
if (dropItem)
|
||||
player.getWorld().dropItemNaturally(npc.getBukkitEntity().getLocation(), reforge);
|
||||
else {
|
||||
for (ItemStack stack : player.getInventory().addItem(reforge).values())
|
||||
player.getWorld().dropItemNaturally(npc.getBukkitEntity().getLocation(), stack);
|
||||
}
|
||||
session = null;
|
||||
// Start cooldown
|
||||
Calendar wait = Calendar.getInstance();
|
||||
wait.add(Calendar.SECOND, reforgeCooldown);
|
||||
cooldowns.put(player.getName(), wait);
|
||||
}
|
||||
|
||||
private boolean reforgeItemInHand() {
|
||||
Random random = new Random();
|
||||
if (random.nextInt(100) < failChance) {
|
||||
for (Enchantment enchantment : reforge.getEnchantments().keySet()) {
|
||||
// Remove or downgrade enchantments
|
||||
if (random.nextBoolean())
|
||||
reforge.removeEnchantment(enchantment);
|
||||
else {
|
||||
if (reforge.getEnchantmentLevel(enchantment) > 1) {
|
||||
reforge.removeEnchantment(enchantment);
|
||||
reforge.addEnchantment(enchantment, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Damage the item
|
||||
short durability = (short) (reforge.getDurability() + reforge.getDurability() * random.nextInt(8));
|
||||
short maxDurability = reforge.getType().getMaxDurability();
|
||||
if (durability <= 0)
|
||||
durability = (short) (maxDurability / 3);
|
||||
else if (reforge.getDurability() + durability > maxDurability)
|
||||
durability = (short) (maxDurability - random.nextInt(maxDurability - 25));
|
||||
reforge.setDurability(durability);
|
||||
return false;
|
||||
}
|
||||
// Add random enchantments
|
||||
int chance = 1;
|
||||
if (reforge.getDurability() == 0)
|
||||
chance *= 4;
|
||||
else
|
||||
reforge.setDurability((short) 0);
|
||||
for (int i = 0; i < chance; i++) {
|
||||
if (reforge.getEnchantments().keySet().size() == maxEnchantments)
|
||||
break;
|
||||
Enchantment enchantment = Enchantment.getById(enchantments[random.nextInt(enchantments.length)]);
|
||||
if (enchantment.canEnchantItem(reforge))
|
||||
reforge.addEnchantment(enchantment, random.nextInt(enchantment.getMaxLevel()) + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return if the session should end
|
||||
private boolean handleClick() {
|
||||
// Prevent player from switching items during session
|
||||
if (!reforge.equals(player.getItemInHand())) {
|
||||
npc.chat(player, itemChangedMsg);
|
||||
return true;
|
||||
}
|
||||
if (!plugin.doesPlayerHaveEnough(player)) {
|
||||
npc.chat(player, insufficientFundsMsg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isRunning() {
|
||||
return plugin.getServer().getScheduler().isQueued(taskId);
|
||||
}
|
||||
|
||||
private boolean isInSession(Player other) {
|
||||
return player.getName().equals(other.getName());
|
||||
}
|
||||
|
||||
private void beginReforge() {
|
||||
taskId = plugin
|
||||
.getServer()
|
||||
.getScheduler()
|
||||
.scheduleAsyncDelayedTask(plugin, this,
|
||||
(new Random().nextInt(maxReforgeDelay) + minReforgeDelay) * 20);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
package net.instinxx.blacksmith;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.character.CharacterFactory;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
|
||||
import net.instinxx.blacksmith.util.Settings;
|
||||
import net.instinxx.blacksmith.util.Settings.Setting;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class BlacksmithPlugin extends JavaPlugin {
|
||||
private Settings config;
|
||||
private Economy economy;
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
config.save();
|
||||
|
||||
getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
config = new Settings(this);
|
||||
config.load();
|
||||
|
||||
// Setup Vault
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(
|
||||
Economy.class);
|
||||
if (economyProvider != null)
|
||||
economy = economyProvider.getProvider();
|
||||
else {
|
||||
// Disable if no economy plugin was found
|
||||
getServer().getLogger().log(Level.SEVERE, "Failed to load an economy plugin. Disabling...");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
CitizensAPI.getCharacterManager().registerCharacter(
|
||||
new CharacterFactory(Blacksmith.class).withName("blacksmith"));
|
||||
|
||||
getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " enabled.");
|
||||
}
|
||||
|
||||
public boolean isTool(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case WOOD_PICKAXE:
|
||||
case WOOD_SPADE:
|
||||
case WOOD_HOE:
|
||||
case WOOD_SWORD:
|
||||
case WOOD_AXE:
|
||||
case STONE_PICKAXE:
|
||||
case STONE_SPADE:
|
||||
case STONE_HOE:
|
||||
case STONE_SWORD:
|
||||
case STONE_AXE:
|
||||
case GOLD_PICKAXE:
|
||||
case GOLD_SPADE:
|
||||
case GOLD_HOE:
|
||||
case GOLD_SWORD:
|
||||
case GOLD_AXE:
|
||||
case IRON_PICKAXE:
|
||||
case IRON_SPADE:
|
||||
case IRON_HOE:
|
||||
case IRON_SWORD:
|
||||
case IRON_AXE:
|
||||
case DIAMOND_PICKAXE:
|
||||
case DIAMOND_SPADE:
|
||||
case DIAMOND_HOE:
|
||||
case DIAMOND_SWORD:
|
||||
case DIAMOND_AXE:
|
||||
case BOW:
|
||||
case FLINT_AND_STEEL:
|
||||
case FISHING_ROD:
|
||||
case SHEARS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isArmor(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_LEGGINGS:
|
||||
case LEATHER_BOOTS:
|
||||
case CHAINMAIL_HELMET:
|
||||
case CHAINMAIL_CHESTPLATE:
|
||||
case CHAINMAIL_LEGGINGS:
|
||||
case CHAINMAIL_BOOTS:
|
||||
case GOLD_HELMET:
|
||||
case GOLD_CHESTPLATE:
|
||||
case GOLD_LEGGINGS:
|
||||
case GOLD_BOOTS:
|
||||
case IRON_HELMET:
|
||||
case IRON_CHESTPLATE:
|
||||
case IRON_LEGGINGS:
|
||||
case IRON_BOOTS:
|
||||
case DIAMOND_HELMET:
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case DIAMOND_LEGGINGS:
|
||||
case DIAMOND_BOOTS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doesPlayerHaveEnough(Player player) {
|
||||
return economy.getBalance(player.getName()) - getCost(player.getItemInHand()) >= 0;
|
||||
}
|
||||
|
||||
public String formatCost(Player player) {
|
||||
return economy.format(getCost(player.getItemInHand()));
|
||||
}
|
||||
|
||||
public void withdraw(Player player) {
|
||||
economy.withdrawPlayer(player.getName(), getCost(player.getItemInHand()));
|
||||
}
|
||||
|
||||
private double getCost(ItemStack item) {
|
||||
DataKey root = config.getConfig().getKey("");
|
||||
double price = Setting.BASE_PRICE.asDouble();
|
||||
if (root.keyExists("base-prices." + item.getType().name().toLowerCase().replace('_', '-')))
|
||||
price = root.getDouble("base-prices." + item.getType().name().toLowerCase().replace('_', '-'));
|
||||
|
||||
// Adjust price based on durability and enchantments
|
||||
price += (item.getType().getMaxDurability() * item.getDurability());
|
||||
|
||||
double enchantmentModifier = Setting.ENCHANTMENT_MODIFIER.asDouble();
|
||||
for (Enchantment enchantment : item.getEnchantments().keySet()) {
|
||||
if (root.keyExists("enchantment-modifiers." + enchantment.getName().toLowerCase().replace('_', '-')))
|
||||
enchantmentModifier = root.getDouble("enchantment-modifiers."
|
||||
+ enchantment.getName().toLowerCase().replace('_', '-'));
|
||||
price += enchantmentModifier * item.getEnchantmentLevel(enchantment);
|
||||
}
|
||||
return price;
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package net.instinxx.blacksmith.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.api.util.YamlStorage;
|
||||
import net.instinxx.blacksmith.BlacksmithPlugin;
|
||||
|
||||
public class Settings {
|
||||
private final YamlStorage config;
|
||||
|
||||
public Settings(BlacksmithPlugin plugin) {
|
||||
config = new YamlStorage(plugin.getDataFolder() + File.separator + "config.yml", "Blacksmith Configuration");
|
||||
}
|
||||
|
||||
public void load() {
|
||||
DataKey root = config.getKey("");
|
||||
for (Setting setting : Setting.values())
|
||||
if (!root.keyExists(setting.path))
|
||||
root.setRaw(setting.path, setting.get());
|
||||
else
|
||||
setting.set(root.getRaw(setting.path));
|
||||
|
||||
save();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
config.save();
|
||||
}
|
||||
|
||||
public YamlStorage getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public enum Setting {
|
||||
BASE_PRICE("base-prices.default", 10),
|
||||
BUSY_WITH_PLAYER_MESSAGE("defaults.messages.busy-with-player", "<c>I'm busy at the moment. Come back later!"),
|
||||
BUSY_WITH_REFORGE_MESSAGE("defaults.messages.busy-with-reforge", "<c>I'm working on it. Be patient!"),
|
||||
COOLDOWN_UNEXPIRED_MESSAGE(
|
||||
"defaults.messages.cooldown-not-expired",
|
||||
"<c>You've already had your chance! Give me a break!"),
|
||||
COST_MESSAGE(
|
||||
"defaults.messages.cost",
|
||||
"<e>It will cost <a><price> <e>to reforge that <a><item><e>! Click again to reforge!"),
|
||||
DROP_ITEM("defaults.drop-item", true),
|
||||
ENCHANTMENT_MODIFIER("enchantment-modifiers.default", 5),
|
||||
FAIL_CHANCE("defaults.percent-chance-to-fail-reforge", 10),
|
||||
FAIL_MESSAGE("defaults.messages.fail-reforge", "<c>Whoops! Didn't mean to do that! Maybe next time?"),
|
||||
INSUFFICIENT_FUNDS_MESSAGE(
|
||||
"defaults.messages.insufficient-funds",
|
||||
"<c>You don't have enough money to reforge that item!"),
|
||||
INVALID_ITEM_MESSAGE("defaults.messages.invalid-item", "<c>I'm sorry, but I don't know how to reforge that!"),
|
||||
ITEM_UNEXPECTEDLY_CHANGED_MESSAGE(
|
||||
"defaults.messages.item-changed-during-reforge",
|
||||
"<c>That's not the item you wanted to reforge before!"),
|
||||
MAX_ENCHANTMENTS("defaults.maximum-enchantments", 1),
|
||||
MAX_REFORGE_DELAY("defaults.delays-in-seconds.maximum", 30),
|
||||
MIN_REFORGE_DELAY("defaults.delays-in-seconds.minimum", 5),
|
||||
REFORGE_COOLDOWN("defaults.delays-in-seconds.reforge-cooldown", 60),
|
||||
START_REFORGE_MESSAGE("defaults.messages.start-reforge", "<e>Ok, let's see what I can do..."),
|
||||
SUCCESS_MESSAGE("defaults.messages.successful-reforge", "<a>There you go! All better!");
|
||||
|
||||
private String path;
|
||||
private Object value;
|
||||
|
||||
Setting(String path, Object value) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return (Boolean) value;
|
||||
}
|
||||
|
||||
public double asDouble() {
|
||||
if (value instanceof String)
|
||||
return Double.valueOf((String) value);
|
||||
if (value instanceof Integer)
|
||||
return (Integer) value;
|
||||
return (Double) value;
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return (Integer) value;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
private Object get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private void set(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
name: Blacksmith
|
||||
author: aPunch
|
||||
version: 1.0
|
||||
main: net.instinxx.blacksmith.BlacksmithPlugin
|
||||
depend: [Citizens, Vault]
|
BIN
target/classes/net/apunch/blacksmith/BlacksmithPlugin.class
Normal file
BIN
target/classes/net/apunch/blacksmith/BlacksmithPlugin.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/net/apunch/blacksmith/BlacksmithTrait.class
Normal file
BIN
target/classes/net/apunch/blacksmith/BlacksmithTrait.class
Normal file
Binary file not shown.
BIN
target/classes/net/apunch/blacksmith/util/Settings$Setting.class
Normal file
BIN
target/classes/net/apunch/blacksmith/util/Settings$Setting.class
Normal file
Binary file not shown.
BIN
target/classes/net/apunch/blacksmith/util/Settings.class
Normal file
BIN
target/classes/net/apunch/blacksmith/util/Settings.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user