-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shifted copying methods into BookSuitePrintingPress to unclutter main class Fixed issue with stairs not remembering type (2.1.0) https://www.dropbox.com/sh/prg3hzlecgjigxf/4GGnhM_LAu/BookSuite%20stair%20error
- Loading branch information
Showing
6 changed files
with
203 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
58 changes: 36 additions & 22 deletions
58
src/com/github/Jikoo/BookSuite/BookSuiteMailExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,57 @@ | ||
package com.github.Jikoo.BookSuite; | ||
|
||
import org.bukkit.ChatColor; | ||
import org.bukkit.Material; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.PlayerInventory; | ||
import org.bukkit.inventory.meta.BookMeta; | ||
|
||
public class BookSuiteMailExecutor { | ||
|
||
BookSuite plugin; | ||
Player p; | ||
String to; | ||
String bookMessageName; | ||
String itemMetaName; | ||
|
||
public BookSuiteMailExecutor(BookSuite plugin){ | ||
public BookSuiteMailExecutor(BookSuite plugin, Player p){ | ||
this.plugin = plugin; | ||
this.p = p; | ||
} | ||
|
||
|
||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
|
||
|
||
|
||
public void sendMail(){ | ||
p.sendMessage(ChatColor.DARK_RED+"This function does not yet exist."); | ||
getSendingData(); | ||
parseSendingData(); | ||
//Verify inventory | ||
//Files! | ||
} | ||
|
||
|
||
|
||
//The whole point is that it's commandless >.> why have a packing slip or details in the book then? | ||
/*public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if (! (sender instanceof Player) ){ | ||
sender.sendMessage(ChatColor.DARK_RED+"you must be a player to use this command"); | ||
return false; | ||
} | ||
Player p = (Player) sender; | ||
*/ | ||
public void getSendingData(){ | ||
PlayerInventory i = p.getInventory(); | ||
ItemStack potentiallyABook = i.getItemInHand(); | ||
if (potentiallyABook.equals(new ItemStack(Material.WRITTEN_BOOK, 1))){ | ||
BookMeta bm = (BookMeta)(potentiallyABook.getItemMeta()); | ||
if (bm.getTitle().equalsIgnoreCase("packing slip") || bm.getTitle().equalsIgnoreCase("packingslip")){ | ||
String to = bm.getPage(0); | ||
String bookMessageName = bm.getPage(1); | ||
String itemMetaName = bm.getPage(2); | ||
} | ||
BookMeta bm = (BookMeta) p.getItemInHand();//This is already guaranteed to be a written book by event handler | ||
String title = bm.getTitle(); | ||
title.replaceFirst("[\\W_]*", "");//(any non [a-zA-Z0-9] consumed) | ||
if (title.equalsIgnoreCase("packingslip")){ | ||
to = bm.getPage(0); | ||
bookMessageName = bm.getPage(1); | ||
itemMetaName = bm.getPage(2); | ||
} | ||
|
||
|
||
|
||
|
||
return true; | ||
} | ||
|
||
public void parseSendingData(){ | ||
to.replaceFirst("\\A.*[Tt][Oo]:\\s*", ""); | ||
to.replaceAll("\\W", ""); | ||
//no clue what we want to do for the rest, but it can be handled in similar format. | ||
} | ||
} |
Oops, something went wrong.