From f33523b8c46ee91506c4108f44ac4e6831d7f70e Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 19 Aug 2015 21:30:27 +0200 Subject: [PATCH] Added announce messages and made some fixes - Added a bunch of commands (/u announce) - Fixed some stuff --- .metadata/.mylyn/.tasks.xml.zip | Bin 250 -> 250 bytes .metadata/.mylyn/tasks.xml.zip | Bin 250 -> 250 bytes .../0/d057cb01fa3d00151c31fb33fff4337f | 7 - .../10/70a9b080083e00151c31fb33fff4337f | 25 -- .../11/50857fe1f93d00151c31fb33fff4337f | 5 - .../15/6060baa6313e00151cbdba8b5f0a340e | 70 ---- .../17/d004cf02fd3d00151c31fb33fff4337f | 24 -- .../19/a03f959e6b3f00151fb6edb183f9215c | 277 ------------- .../1e/50995637313e00151cbdba8b5f0a340e | 66 --- .../20/10fb34ff313e00151cbdba8b5f0a340e | 70 ---- .../22/50b446ea313e00151cbdba8b5f0a340e | 70 ---- .../24/40ebdecc6b3f00151fb6edb183f9215c | 285 ------------- .../24/f05e1fe03f3f00151fb6edb183f9215c | 31 -- .../28/50c3d09efd3d00151c31fb33fff4337f | 26 -- .../29/500adc32083e00151c31fb33fff4337f | 25 -- .../2a/e01483b3313e00151cbdba8b5f0a340e | 70 ---- .../2a/e078d72f343e00151cbdba8b5f0a340e | 70 ---- .../2b/8042c3dd6b3f00151fb6edb183f9215c | 285 ------------- .../2f/70a2035a333e00151cbdba8b5f0a340e | 7 - .../34/e07767e9313e00151cbdba8b5f0a340e | 74 ---- .../36/e04434aa313e00151cbdba8b5f0a340e | 70 ---- .../38/f01dd9d8333e00151cbdba8b5f0a340e | 8 - .../39/30814aea6b3f00151fb6edb183f9215c | 286 ------------- .../39/e05f8acf313e00151cbdba8b5f0a340e | 74 ---- .../3a/d0a96a2e313e00151cbdba8b5f0a340e | 66 --- .../3c/508e5c2c053e00151c31fb33fff4337f | 25 -- .../3f/5082b24efd3d00151c31fb33fff4337f | 24 -- .../4/d01b9292fc3d00151c31fb33fff4337f | 15 - .../42/50bc64c9313e00151cbdba8b5f0a340e | 74 ---- .../43/b06648906c3f00151fb6edb183f9215c | 290 ------------- .../43/f011b9b4333e00151cbdba8b5f0a340e | 347 ---------------- .../44/40c13c85083e00151c31fb33fff4337f | 25 -- .../47/b0efe5c83f3f00151fb6edb183f9215c | 31 -- .../49/c0672b28053e00151c31fb33fff4337f | 25 -- .../4e/e0d3ac3b0c3e00151089cca86c5b1a99 | 25 -- .../5/c0df337dfd3d00151c31fb33fff4337f | 27 -- .../53/d0e9bcd5333e00151cbdba8b5f0a340e | 6 - .../5a/602205ac333e00151cbdba8b5f0a340e | 8 - .../5d/608dcfff313e00151cbdba8b5f0a340e | 70 ---- .../60/009554caf93d00151c31fb33fff4337f | 0 .../60/607ba075fd3d00151c31fb33fff4337f | 26 -- .../65/e0e09818313e00151cbdba8b5f0a340e | 67 --- .../66/40244c64fd3d00151c31fb33fff4337f | 25 -- .../67/f0473bebf93d00151c31fb33fff4337f | 6 - .../68/5008c7fc313e00151cbdba8b5f0a340e | 70 ---- .../6a/303f85d66d3f00151fb6edb183f9215c | 293 ------------- .../6b/501ffbd8fb3d00151c31fb33fff4337f | 14 - .../6c/e07524e9f93d00151c31fb33fff4337f | 6 - .../6e/f0362afd313e00151cbdba8b5f0a340e | 70 ---- .../6f/d08b30cdf93d00151c31fb33fff4337f | 5 - .../72/008777b4313e00151cbdba8b5f0a340e | 71 ---- .../72/704702fe313e00151cbdba8b5f0a340e | 70 ---- .../74/70e4dd2b313e00151cbdba8b5f0a340e | 66 --- .../77/c062443b883e00151ce8ff6d4f74dabd | 30 -- .../7b/004a78fdfc3d00151c31fb33fff4337f | 21 - .../7f/500624aa333e00151cbdba8b5f0a340e | 6 - .../8/608aaa5d333e00151cbdba8b5f0a340e | 7 - .../80/30fd52f56d3f00151fb6edb183f9215c | 7 - .../87/b0b359446e3f00151fb6edb183f9215c | 294 ------------- .../8c/303a3a836b3f00151fb6edb183f9215c | 277 ------------- .../8e/603503de313e00151cbdba8b5f0a340e | 74 ---- .../90/e0cf9548333e00151cbdba8b5f0a340e | 0 .../93/e0833e34313e00151cbdba8b5f0a340e | 66 --- .../97/d0e97d74fc3d00151c31fb33fff4337f | 15 - .../98/a09a052a343e00151cbdba8b5f0a340e | 6 - .../99/6080b854333e00151cbdba8b5f0a340e | 5 - .../9a/309bd1b16c3f00151fb6edb183f9215c | 291 ------------- .../9b/50bbab1a313e00151cbdba8b5f0a340e | 25 -- .../a5/40a714b86b3f00151fb6edb183f9215c | 278 ------------- .../aa/80130ae1833e00151ce8ff6d4f74dabd | 70 ---- .../aa/b06bd2ac6b3f00151fb6edb183f9215c | 278 ------------- .../ab/30c56ef06b3f00151fb6edb183f9215c | 290 ------------- .../ab/c074771bfa3d00151c31fb33fff4337f | 11 - .../ab/e0694d38883e00151ce8ff6d4f74dabd | 24 -- .../b1/d01b5059313e00151cbdba8b5f0a340e | 67 --- .../b2/e05c77a7333e00151cbdba8b5f0a340e | 386 ------------------ .../b5/60e643b8333e00151cbdba8b5f0a340e | 331 --------------- .../b5/d0028812fa3d00151c31fb33fff4337f | 10 - .../b7/308c4f936c3f00151fb6edb183f9215c | 291 ------------- .../b7/500aa169fd3d00151c31fb33fff4337f | 25 -- .../ba/50775507fd3d00151c31fb33fff4337f | 24 -- .../bd/c0c10ce46b3f00151fb6edb183f9215c | 287 ------------- .../bd/d05bd96d083e00151c31fb33fff4337f | 26 -- .../bf/b03cb8c36b3f00151fb6edb183f9215c | 285 ------------- .../c/609f275f313e00151cbdba8b5f0a340e | 70 ---- .../c/b022c7a5213f00151fb6edb183f9215c | 71 ---- .../c0/b0b29cfe313e00151cbdba8b5f0a340e | 70 ---- .../c2/e08d9071fc3d00151c31fb33fff4337f | 14 - .../c4/50682add833e00151ce8ff6d4f74dabd | 70 ---- .../c7/b027ea9c6b3f00151fb6edb183f9215c | 277 ------------- .../ce/b03944c06d3f00151fb6edb183f9215c | 293 ------------- .../cf/50fc0176fd3d00151c31fb33fff4337f | 27 -- .../d0/40969eebfc3d00151c31fb33fff4337f | 19 - .../d1/d0e5e980a03e00151ce8ff6d4f74dabd | 70 ---- .../d5/60556449313e00151cbdba8b5f0a340e | 67 --- .../d6/d059d3b7fd3d00151c31fb33fff4337f | 25 -- .../d7/d06d9fe5f93d00151c31fb33fff4337f | 5 - .../d9/305eeba36b3f00151fb6edb183f9215c | 277 ------------- .../d9/30852a8e6b3f00151fb6edb183f9215c | 277 ------------- .../db/d0069951053e00151c31fb33fff4337f | 26 -- .../de/500da46afb3d00151c31fb33fff4337f | 11 - .../de/d037d008fa3d00151c31fb33fff4337f | 9 - .../e1/b07ff7bc6d3f00151fb6edb183f9215c | 291 ------------- .../e1/d020d619fa3d00151c31fb33fff4337f | 10 - .../e3/602ab6bd313e00151cbdba8b5f0a340e | 71 ---- .../e4/60215032313e00151cbdba8b5f0a340e | 66 --- .../e4/60f9a9af313e00151cbdba8b5f0a340e | 70 ---- .../e7/d06d6706fd3d00151c31fb33fff4337f | 24 -- .../ec/c0d3c395fc3d00151c31fb33fff4337f | 19 - .../f0/d01b9bcffc3d00151c31fb33fff4337f | 19 - .../f1/b00a25cf6b3f00151fb6edb183f9215c | 284 ------------- .../f3/d0a2d21dfa3d00151c31fb33fff4337f | 11 - .../f4/303fdacd3f3f00151fb6edb183f9215c | 31 -- .../f4/d034285bfd3d00151c31fb33fff4337f | 25 -- .../.indexes/e4/77/69/e/history.index | Bin 6030 -> 4440 bytes .../TheButtonAutoFlair/.indexes/history.index | Bin 116 -> 68 bytes .../.projects/TheButtonAutoFlair/.markers | Bin 1774 -> 1235 bytes .../.safetable/org.eclipse.core.resources | Bin 12486 -> 1763 bytes .../.settings/org.eclipse.jdt.ui.prefs | 2 +- .../org.eclipse.e4.workbench/workbench.xmi | 116 +++--- .../org.eclipse.jdt.core/1508644233.index | Bin 17899 -> 18476 bytes .../QualifiedTypeNameHistory.xml | 10 +- .../dialog_settings.xml | 2 + .../tk/sznp/thebuttonautoflair/Commands.class | Bin 9429 -> 13018 bytes .../thebuttonautoflair/PluginMain$1.class | Bin 679 -> 679 bytes .../sznp/thebuttonautoflair/PluginMain.class | Bin 13721 -> 15142 bytes .../thebuttonautoflair/AnnouncerThread.java | 23 ++ .../tk/sznp/thebuttonautoflair/Commands.java | 142 +++++++ .../sznp/thebuttonautoflair/PluginMain.java | 82 +++- 129 files changed, 309 insertions(+), 10246 deletions(-) delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/d057cb01fa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/70a9b080083e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/11/50857fe1f93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/6060baa6313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/d004cf02fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/a03f959e6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/50995637313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/10fb34ff313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/50b446ea313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/40ebdecc6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/f05e1fe03f3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/28/50c3d09efd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/500adc32083e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2a/e01483b3313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2a/e078d72f343e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/8042c3dd6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2f/70a2035a333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/e07767e9313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/e04434aa313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/f01dd9d8333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/30814aea6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/e05f8acf313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3a/d0a96a2e313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/508e5c2c053e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3f/5082b24efd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4/d01b9292fc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/50bc64c9313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/b06648906c3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/f011b9b4333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/40c13c85083e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/47/b0efe5c83f3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/49/c0672b28053e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4e/e0d3ac3b0c3e00151089cca86c5b1a99 delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5/c0df337dfd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/53/d0e9bcd5333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/602205ac333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/608dcfff313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/009554caf93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/607ba075fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/65/e0e09818313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/66/40244c64fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/f0473bebf93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/68/5008c7fc313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/303f85d66d3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6b/501ffbd8fb3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6c/e07524e9f93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6e/f0362afd313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6f/d08b30cdf93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/008777b4313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/704702fe313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/70e4dd2b313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/c062443b883e00151ce8ff6d4f74dabd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7b/004a78fdfc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/500624aa333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8/608aaa5d333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/80/30fd52f56d3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/87/b0b359446e3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8c/303a3a836b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8e/603503de313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/e0cf9548333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/93/e0833e34313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/d0e97d74fc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/98/a09a052a343e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/99/6080b854333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9a/309bd1b16c3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9b/50bbab1a313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a5/40a714b86b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/80130ae1833e00151ce8ff6d4f74dabd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/b06bd2ac6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/30c56ef06b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/c074771bfa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/e0694d38883e00151ce8ff6d4f74dabd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/d01b5059313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/e05c77a7333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b5/60e643b8333e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b5/d0028812fa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b7/308c4f936c3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b7/500aa169fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/50775507fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/c0c10ce46b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/d05bd96d083e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bf/b03cb8c36b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/609f275f313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/b022c7a5213f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/b0b29cfe313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c2/e08d9071fc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c4/50682add833e00151ce8ff6d4f74dabd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c7/b027ea9c6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ce/b03944c06d3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/50fc0176fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d0/40969eebfc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/d0e5e980a03e00151ce8ff6d4f74dabd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d5/60556449313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d6/d059d3b7fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d7/d06d9fe5f93d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/305eeba36b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/30852a8e6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/db/d0069951053e00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/500da46afb3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/d037d008fa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/b07ff7bc6d3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/d020d619fa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/602ab6bd313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/60215032313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/60f9a9af313e00151cbdba8b5f0a340e delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/d06d6706fd3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ec/c0d3c395fc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f0/d01b9bcffc3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f1/b00a25cf6b3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f3/d0a2d21dfa3d00151c31fb33fff4337f delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f4/303fdacd3f3f00151fb6edb183f9215c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f4/d034285bfd3d00151c31fb33fff4337f create mode 100644 TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/AnnouncerThread.java diff --git a/.metadata/.mylyn/.tasks.xml.zip b/.metadata/.mylyn/.tasks.xml.zip index 1eca0c906abeff3ffbc72ba5ec06880cce25c141..5d0e7db1a97684821c45f660dc3a3801914edc54 100644 GIT binary patch delta 26 gcmeyx_=}Mzz?+#xgn@&DgW AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/50857fe1f93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/11/50857fe1f93d00151c31fb33fff4337f deleted file mode 100644 index cf0bfb7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/11/50857fe1f93d00151c31fb33fff4337f +++ /dev/null @@ -1,5 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/6060baa6313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/15/6060baa6313e00151cbdba8b5f0a340e deleted file mode 100644 index 3ec657c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/6060baa6313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { - - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/d004cf02fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/17/d004cf02fd3d00151c31fb33fff4337f deleted file mode 100644 index 95612ac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/17/d004cf02fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,24 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - if(!AllPlayers.contains(name)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/a03f959e6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/19/a03f959e6b3f00151fb6edb183f9215c deleted file mode 100644 index 16db329..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/a03f959e6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,277 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(URL, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/50995637313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/50995637313e00151cbdba8b5f0a340e deleted file mode 100644 index d33e6dc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/50995637313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,66 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/10fb34ff313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/20/10fb34ff313e00151cbdba8b5f0a340e deleted file mode 100644 index 2ade719..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/10fb34ff313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/50b446ea313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/22/50b446ea313e00151cbdba8b5f0a340e deleted file mode 100644 index eda6b64..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/22/50b446ea313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(arg0, arg1) - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/40ebdecc6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/24/40ebdecc6b3f00151fb6edb183f9215c deleted file mode 100644 index 8a95c0c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/40ebdecc6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,285 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } - } catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/f05e1fe03f3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/24/f05e1fe03f3f00151fb6edb183f9215c deleted file mode 100644 index ade377b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/f05e1fe03f3f00151fb6edb183f9215c +++ /dev/null @@ -1,31 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public boolean FlairDecided; //2015.08.09. - private static HashMap AllPlayers=new HashMap<>(); - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } - /*public enum FlairClassType - { //2015.08.09. - NonPresser, - CantPress, - Undecided - }*/ -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/28/50c3d09efd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/28/50c3d09efd3d00151c31fb33fff4337f deleted file mode 100644 index 52c12fe..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/28/50c3d09efd3d00151c31fb33fff4337f +++ /dev/null @@ -1,26 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/500adc32083e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/29/500adc32083e00151c31fb33fff4337f deleted file mode 100644 index 3c5dbca..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/500adc32083e00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e01483b3313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e01483b3313e00151cbdba8b5f0a340e deleted file mode 100644 index 2fd48b2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e01483b3313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index = message.indexOf(p.getName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e078d72f343e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e078d72f343e00151cbdba8b5f0a340e deleted file mode 100644 index d263650..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/e078d72f343e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName; - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/8042c3dd6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/8042c3dd6b3f00151fb6edb183f9215c deleted file mode 100644 index 5012a4d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/8042c3dd6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,285 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/70a2035a333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/2f/70a2035a333e00151cbdba8b5f0a340e deleted file mode 100644 index a45dd73..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/70a2035a333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,7 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import com.earth2me.essentials.IEssentials; - -public class Essentials implements IEssentials { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/e07767e9313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/34/e07767e9313e00151cbdba8b5f0a340e deleted file mode 100644 index 4531ada..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/34/e07767e9313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,74 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - while((index = message.indexOf(p.getName()))!=-1) - { - - } - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/e04434aa313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/36/e04434aa313e00151cbdba8b5f0a340e deleted file mode 100644 index d2a72bd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/36/e04434aa313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { - int index = message.indexOf(p.getName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/f01dd9d8333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/38/f01dd9d8333e00151cbdba8b5f0a340e deleted file mode 100644 index 41c7113..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/38/f01dd9d8333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,8 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import net.ess3.api.IUser; - -public class Essentials -{ - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/30814aea6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/39/30814aea6b3f00151fb6edb183f9215c deleted file mode 100644 index a3a4f6f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/30814aea6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,286 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/e05f8acf313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/39/e05f8acf313e00151cbdba8b5f0a340e deleted file mode 100644 index 153978e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/e05f8acf313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,74 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - while((index = message.indexOf(p.getName()))!=-1) - { - - } - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/d0a96a2e313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/d0a96a2e313e00151cbdba8b5f0a340e deleted file mode 100644 index 5dd7da9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/d0a96a2e313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,66 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message; - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+event.getMessage()); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/508e5c2c053e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/508e5c2c053e00151c31fb33fff4337f deleted file mode 100644 index 3c5dbca..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/508e5c2c053e00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/5082b24efd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/5082b24efd3d00151c31fb33fff4337f deleted file mode 100644 index cad1a26..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/5082b24efd3d00151c31fb33fff4337f +++ /dev/null @@ -1,24 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/d01b9292fc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/4/d01b9292fc3d00151c31fb33fff4337f deleted file mode 100644 index 153d7e5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4/d01b9292fc3d00151c31fb33fff4337f +++ /dev/null @@ -1,15 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/50bc64c9313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/42/50bc64c9313e00151cbdba8b5f0a340e deleted file mode 100644 index 05f0ff1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/42/50bc64c9313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,74 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - while((index = message.indexOf(p.getName())!=-1) - { - - } - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/b06648906c3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/43/b06648906c3f00151fb6edb183f9215c deleted file mode 100644 index 2e1e4d0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/43/b06648906c3f00151fb6edb183f9215c +++ /dev/null @@ -1,290 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/f011b9b4333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/43/f011b9b4333e00151cbdba8b5f0a340e deleted file mode 100644 index 3cde012..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/43/f011b9b4333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,347 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import com.earth2me.essentials.CommandSource; -import com.earth2me.essentials.User; -import com.earth2me.essentials.commands.IEssentialsCommand; - -import net.ess3.api.ITeleport; -import net.ess3.api.IUser; -import net.ess3.api.MaxMoneyException; - -public class Essentials implements IUser -{ - - @Override - public void addMail(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public boolean canAfford(BigDecimal arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean canBuild() { - // TODO Auto-generated method stub - return false; - } - - @Override - public Boolean canSpawnItem(int arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void delHome(String arg0) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void enableInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - - } - - @Override - public Player getBase() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set getConfigKeys() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map getConfigMap() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map getConfigMap(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getGroup() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getHome(String arg0) throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getHome(Location arg0) throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getHomes() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJail() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getLastLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getLastTeleportTimestamp() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Location getLogoutLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getMails() { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getMoney() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public CommandSource getSource() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ITeleport getTeleport() { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getTeleportRequestTime() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void giveMoney(BigDecimal arg0) throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public void giveMoney(BigDecimal arg0, CommandSource arg1) - throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public boolean hasHome() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean hasInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void healCooldown() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean inGroup(String arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAfk() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(String arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(IEssentialsCommand arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(IEssentialsCommand arg0, String arg1) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isGodModeEnabled() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isHidden() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isIgnoreExempt() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isVanished() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void payUser(User arg0, BigDecimal arg1) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void requestTeleport(User arg0, boolean arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void resetInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - - } - - @Override - public void sendMessage(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setAfk(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setConfigProperty(String arg0, Object arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void setHidden(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setHome(String arg0, Location arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void setJail(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setLastLocation() { - // TODO Auto-generated method stub - - } - - @Override - public void setLastTeleportTimestamp(long arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setLogoutLocation() { - // TODO Auto-generated method stub - - } - - @Override - public void setMoney(BigDecimal arg0) throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public void setVanished(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void takeMoney(BigDecimal arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void takeMoney(BigDecimal arg0, CommandSource arg1) { - // TODO Auto-generated method stub - - } - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/40c13c85083e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/44/40c13c85083e00151c31fb33fff4337f deleted file mode 100644 index 913297a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/44/40c13c85083e00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/47/b0efe5c83f3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/47/b0efe5c83f3f00151fb6edb183f9215c deleted file mode 100644 index 28679fc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/47/b0efe5c83f3f00151fb6edb183f9215c +++ /dev/null @@ -1,31 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public boolean FlairDecided; //2015.08.09. - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } - /*public enum FlairClassType - { //2015.08.09. - NonPresser, - CantPress, - Undecided - }*/ -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/49/c0672b28053e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/49/c0672b28053e00151c31fb33fff4337f deleted file mode 100644 index 3c5dbca..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/49/c0672b28053e00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/e0d3ac3b0c3e00151089cca86c5b1a99 b/.metadata/.plugins/org.eclipse.core.resources/.history/4e/e0d3ac3b0c3e00151089cca86c5b1a99 deleted file mode 100644 index 66ed2d6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/e0d3ac3b0c3e00151089cca86c5b1a99 +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5/c0df337dfd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/5/c0df337dfd3d00151c31fb33fff4337f deleted file mode 100644 index e7a09c9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5/c0df337dfd3d00151c31fb33fff4337f +++ /dev/null @@ -1,27 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/53/d0e9bcd5333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/53/d0e9bcd5333e00151cbdba8b5f0a340e deleted file mode 100644 index ca0b02d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/53/d0e9bcd5333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,6 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class Essentials implements IUser -{ - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/602205ac333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/602205ac333e00151cbdba8b5f0a340e deleted file mode 100644 index 58ffb85..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/602205ac333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,8 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import net.ess3.api.IUser; - -public class Essentials implements IUser -{ - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/608dcfff313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/608dcfff313e00151cbdba8b5f0a340e deleted file mode 100644 index 2ade719..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/608dcfff313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/009554caf93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/60/009554caf93d00151c31fb33fff4337f deleted file mode 100644 index e69de29..0000000 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/607ba075fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/60/607ba075fd3d00151c31fb33fff4337f deleted file mode 100644 index 989d005..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/607ba075fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,26 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0e09818313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0e09818313e00151cbdba8b5f0a340e deleted file mode 100644 index e17c425..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0e09818313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,67 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - //event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+"(test)> "+event.getMessage()); //2015.08.08. - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message; - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+event.getMessage()); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/66/40244c64fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/66/40244c64fd3d00151c31fb33fff4337f deleted file mode 100644 index 3278b5c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/66/40244c64fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayer(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0473bebf93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0473bebf93d00151c31fb33fff4337f deleted file mode 100644 index eed0fb5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0473bebf93d00151c31fb33fff4337f +++ /dev/null @@ -1,6 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String UserName; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/68/5008c7fc313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/68/5008c7fc313e00151cbdba8b5f0a340e deleted file mode 100644 index 6ba24bb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/68/5008c7fc313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(arg0, arg1) - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/303f85d66d3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/303f85d66d3f00151fb6edb183f9215c deleted file mode 100644 index 65f63fb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/303f85d66d3f00151fb6edb183f9215c +++ /dev/null @@ -1,293 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - case "opme": //2015.08.10. - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/501ffbd8fb3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/501ffbd8fb3d00151c31fb33fff4337f deleted file mode 100644 index 9e3f840..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/501ffbd8fb3d00151c31fb33fff4337f +++ /dev/null @@ -1,14 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static ArrayList AllPlayers=new ArrayList<>(); //2015.08.08. -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e07524e9f93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e07524e9f93d00151c31fb33fff4337f deleted file mode 100644 index c2c0b73..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e07524e9f93d00151c31fb33fff4337f +++ /dev/null @@ -1,6 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f0362afd313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f0362afd313e00151cbdba8b5f0a340e deleted file mode 100644 index f25045c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f0362afd313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName()) - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6f/d08b30cdf93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/6f/d08b30cdf93d00151c31fb33fff4337f deleted file mode 100644 index b36faea..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6f/d08b30cdf93d00151c31fb33fff4337f +++ /dev/null @@ -1,5 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/008777b4313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/72/008777b4313e00151cbdba8b5f0a340e deleted file mode 100644 index 8938516..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/72/008777b4313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,71 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - index = message.indexOf(p.getName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/704702fe313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/72/704702fe313e00151cbdba8b5f0a340e deleted file mode 100644 index 2ade719..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/72/704702fe313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/70e4dd2b313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/74/70e4dd2b313e00151cbdba8b5f0a340e deleted file mode 100644 index 5dd7da9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/74/70e4dd2b313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,66 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message; - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+event.getMessage()); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/c062443b883e00151ce8ff6d4f74dabd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/c062443b883e00151ce8ff6d4f74dabd deleted file mode 100644 index 4f114f8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/c062443b883e00151ce8ff6d4f74dabd +++ /dev/null @@ -1,30 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class -String message="§cUsage: /u admin playerinfo §r"; -if(player==null) - System.out.println(message); -else - player.sendMessage(message); -return; -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/004a78fdfc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/004a78fdfc3d00151c31fb33fff4337f deleted file mode 100644 index 2867be2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/004a78fdfc3d00151c31fb33fff4337f +++ /dev/null @@ -1,21 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/500624aa333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/500624aa333e00151cbdba8b5f0a340e deleted file mode 100644 index 19e1033..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/500624aa333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,6 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class Essentials implements IUser -{ - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/608aaa5d333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/8/608aaa5d333e00151cbdba8b5f0a340e deleted file mode 100644 index 5ff4366..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8/608aaa5d333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,7 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import net.ess3.api.IEssentials; - -public class Essentials implements IEssentials { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/80/30fd52f56d3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/80/30fd52f56d3f00151fb6edb183f9215c deleted file mode 100644 index 9ef0403..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/80/30fd52f56d3f00151fb6edb183f9215c +++ /dev/null @@ -1,7 +0,0 @@ -name: TheButtonAutoFlair -main: tk.sznp.thebuttonautoflair.PluginMain -version: 1.0 -commands: - u: - description: Auto-flair system. Accept or ignore flair. - usage: "&cUsage: /u accept|ignore|&r" diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/87/b0b359446e3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/87/b0b359446e3f00151fb6edb183f9215c deleted file mode 100644 index e85cf3c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/87/b0b359446e3f00151fb6edb183f9215c +++ /dev/null @@ -1,294 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - case "opme": //2015.08.10. - player.sendMessage("It would be nice, isn't it?"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/303a3a836b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/303a3a836b3f00151fb6edb183f9215c deleted file mode 100644 index ac808fa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/303a3a836b3f00151fb6edb183f9215c +++ /dev/null @@ -1,277 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - String URL="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(URL, "plugins/TheButtonAutoFlair.jar") - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/603503de313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/603503de313e00151cbdba8b5f0a340e deleted file mode 100644 index 4531ada..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/603503de313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,74 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - while((index = message.indexOf(p.getName()))!=-1) - { - - } - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/e0cf9548333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/90/e0cf9548333e00151cbdba8b5f0a340e deleted file mode 100644 index e69de29..0000000 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/93/e0833e34313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/93/e0833e34313e00151cbdba8b5f0a340e deleted file mode 100644 index b905d63..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/93/e0833e34313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,66 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message= - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0e97d74fc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0e97d74fc3d00151c31fb33fff4337f deleted file mode 100644 index 1eb050a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0e97d74fc3d00151c31fb33fff4337f +++ /dev/null @@ -1,15 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/98/a09a052a343e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/98/a09a052a343e00151cbdba8b5f0a340e deleted file mode 100644 index fa6671e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/98/a09a052a343e00151cbdba8b5f0a340e +++ /dev/null @@ -1,6 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class Essentials -{ - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/99/6080b854333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/99/6080b854333e00151cbdba8b5f0a340e deleted file mode 100644 index 5e9ffd7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/99/6080b854333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,5 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class Essentials { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/309bd1b16c3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/309bd1b16c3f00151fb6edb183f9215c deleted file mode 100644 index 0c6f200..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/309bd1b16c3f00151fb6edb183f9215c +++ /dev/null @@ -1,291 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9b/50bbab1a313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/9b/50bbab1a313e00151cbdba8b5f0a340e deleted file mode 100644 index 79bdfc7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9b/50bbab1a313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - //public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40a714b86b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40a714b86b3f00151fb6edb183f9215c deleted file mode 100644 index 4ea3e75..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40a714b86b3f00151fb6edb183f9215c +++ /dev/null @@ -1,278 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url=new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/80130ae1833e00151ce8ff6d4f74dabd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/80130ae1833e00151ce8ff6d4f74dabd deleted file mode 100644 index 9df5fd6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/80130ae1833e00151ce8ff6d4f74dabd +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - //message.replaceAll(p.getName(), ) - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b06bd2ac6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b06bd2ac6b3f00151fb6edb183f9215c deleted file mode 100644 index ba8363c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b06bd2ac6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,278 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/30c56ef06b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/30c56ef06b3f00151fb6edb183f9215c deleted file mode 100644 index e016984..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/30c56ef06b3f00151fb6edb183f9215c +++ /dev/null @@ -1,290 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c074771bfa3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c074771bfa3d00151c31fb33fff4337f deleted file mode 100644 index 5b17225..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c074771bfa3d00151c31fb33fff4337f +++ /dev/null @@ -1,11 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String UserName; - String Flair; - boolean AcceptedFlair; - boolean IgnoredFlair; - String TownColors; - String DisplayName; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/e0694d38883e00151ce8ff6d4f74dabd b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/e0694d38883e00151ce8ff6d4f74dabd deleted file mode 100644 index 6549d0e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/e0694d38883e00151ce8ff6d4f74dabd +++ /dev/null @@ -1,24 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/d01b5059313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/d01b5059313e00151cbdba8b5f0a340e deleted file mode 100644 index 8cec1f9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/d01b5059313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,67 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for() - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/e05c77a7333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/e05c77a7333e00151cbdba8b5f0a340e deleted file mode 100644 index 9c6bf3d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/e05c77a7333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,386 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.logging.Logger; - -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -import com.avaje.ebean.EbeanServer; -import com.earth2me.essentials.AlternativeCommandsHandler; -import com.earth2me.essentials.Backup; -import com.earth2me.essentials.CommandSource; -import com.earth2me.essentials.EssentialsTimer; -import com.earth2me.essentials.I18n; -import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentialsModule; -import com.earth2me.essentials.ISettings; -import com.earth2me.essentials.IUser; -import com.earth2me.essentials.TNTExplodeListener; -import com.earth2me.essentials.User; -import com.earth2me.essentials.UserMap; -import com.earth2me.essentials.Worth; -import com.earth2me.essentials.api.IItemDb; -import com.earth2me.essentials.api.IJails; -import com.earth2me.essentials.api.IWarps; -import com.earth2me.essentials.metrics.Metrics; -import com.earth2me.essentials.perm.PermissionsHandler; -import com.earth2me.essentials.register.payment.Methods; - -import net.ess3.api.IEssentials; - -public class Essentials implements IEssentials { - - @Override - public void addReloadListener(IConf arg0) { - // TODO Auto-generated method stub - - } - - @Override - public int broadcastMessage(String arg0) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int broadcastMessage(IUser arg0, String arg1) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int broadcastMessage(String arg0, String arg1) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public AlternativeCommandsHandler getAlternativeCommandsHandler() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Backup getBackup() { - // TODO Auto-generated method stub - return null; - } - - @Override - public I18n getI18n() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IItemDb getItemDb() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IJails getJails() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Metrics getMetrics() { - // TODO Auto-generated method stub - return null; - } - - @Override - public User getOfflineUser(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Methods getPaymentMethod() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PermissionsHandler getPermissionsHandler() { - // TODO Auto-generated method stub - return null; - } - - @Override - public BukkitScheduler getScheduler() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ISettings getSettings() { - // TODO Auto-generated method stub - return null; - } - - @Override - public TNTExplodeListener getTNTListener() { - // TODO Auto-generated method stub - return null; - } - - @Override - public EssentialsTimer getTimer() { - // TODO Auto-generated method stub - return null; - } - - @Override - @Deprecated - public User getUser(Object arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public User getUser(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public User getUser(Player arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public UserMap getUserMap() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getVanishedPlayers() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IWarps getWarps() { - // TODO Auto-generated method stub - return null; - } - - @Override - public World getWorld(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Worth getWorth() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean onCommandEssentials(CommandSender arg0, Command arg1, - String arg2, String[] arg3, ClassLoader arg4, String arg5, - String arg6, IEssentialsModule arg7) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void reload() { - // TODO Auto-generated method stub - - } - - @Override - public BukkitTask runTaskAsynchronously(Runnable arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public BukkitTask runTaskLaterAsynchronously(Runnable arg0, long arg1) { - // TODO Auto-generated method stub - return null; - } - - @Override - public int scheduleSyncDelayedTask(Runnable arg0) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int scheduleSyncDelayedTask(Runnable arg0, long arg1) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int scheduleSyncRepeatingTask(Runnable arg0, long arg1, long arg2) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void setMetrics(Metrics arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void showError(CommandSource arg0, Throwable arg1, String arg2) { - // TODO Auto-generated method stub - - } - - @Override - public FileConfiguration getConfig() { - // TODO Auto-generated method stub - return null; - } - - @Override - public File getDataFolder() { - // TODO Auto-generated method stub - return null; - } - - @Override - public EbeanServer getDatabase() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ChunkGenerator getDefaultWorldGenerator(String arg0, String arg1) { - // TODO Auto-generated method stub - return null; - } - - @Override - public PluginDescriptionFile getDescription() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Logger getLogger() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PluginLoader getPluginLoader() { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getResource(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Server getServer() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isEnabled() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isNaggable() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void onDisable() { - // TODO Auto-generated method stub - - } - - @Override - public void onEnable() { - // TODO Auto-generated method stub - - } - - @Override - public void onLoad() { - // TODO Auto-generated method stub - - } - - @Override - public void reloadConfig() { - // TODO Auto-generated method stub - - } - - @Override - public void saveConfig() { - // TODO Auto-generated method stub - - } - - @Override - public void saveDefaultConfig() { - // TODO Auto-generated method stub - - } - - @Override - public void saveResource(String arg0, boolean arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void setNaggable(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public List onTabComplete(CommandSender arg0, Command arg1, - String arg2, String[] arg3) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean onCommand(CommandSender arg0, Command arg1, String arg2, - String[] arg3) { - // TODO Auto-generated method stub - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60e643b8333e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60e643b8333e00151cbdba8b5f0a340e deleted file mode 100644 index 77f891d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60e643b8333e00151cbdba8b5f0a340e +++ /dev/null @@ -1,331 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class Essentials implements IUser -{ - - @Override - public void addMail(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public boolean canAfford(BigDecimal arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean canBuild() { - // TODO Auto-generated method stub - return false; - } - - @Override - public Boolean canSpawnItem(int arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void delHome(String arg0) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void enableInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - - } - - @Override - public Player getBase() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set getConfigKeys() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map getConfigMap() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map getConfigMap(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getGroup() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getHome(String arg0) throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getHome(Location arg0) throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getHomes() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJail() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Location getLastLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getLastTeleportTimestamp() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Location getLogoutLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getMails() { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getMoney() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public CommandSource getSource() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ITeleport getTeleport() { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getTeleportRequestTime() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void giveMoney(BigDecimal arg0) throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public void giveMoney(BigDecimal arg0, CommandSource arg1) - throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public boolean hasHome() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean hasInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void healCooldown() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean inGroup(String arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAfk() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(String arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(IEssentialsCommand arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAuthorized(IEssentialsCommand arg0, String arg1) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isGodModeEnabled() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isHidden() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isIgnoreExempt() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isVanished() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void payUser(User arg0, BigDecimal arg1) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void requestTeleport(User arg0, boolean arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void resetInvulnerabilityAfterTeleport() { - // TODO Auto-generated method stub - - } - - @Override - public void sendMessage(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setAfk(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setConfigProperty(String arg0, Object arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void setHidden(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setHome(String arg0, Location arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void setJail(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setLastLocation() { - // TODO Auto-generated method stub - - } - - @Override - public void setLastTeleportTimestamp(long arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setLogoutLocation() { - // TODO Auto-generated method stub - - } - - @Override - public void setMoney(BigDecimal arg0) throws MaxMoneyException { - // TODO Auto-generated method stub - - } - - @Override - public void setVanished(boolean arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void takeMoney(BigDecimal arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void takeMoney(BigDecimal arg0, CommandSource arg1) { - // TODO Auto-generated method stub - - } - -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d0028812fa3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d0028812fa3d00151c31fb33fff4337f deleted file mode 100644 index d15ab52..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d0028812fa3d00151c31fb33fff4337f +++ /dev/null @@ -1,10 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String UserName; - String Flair; - boolean AcceptedFlair; - boolean IgnoredFlair; - String TownColor; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/308c4f936c3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/308c4f936c3f00151fb6edb183f9215c deleted file mode 100644 index ee6d096..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/308c4f936c3f00151fb6edb183f9215c +++ /dev/null @@ -1,291 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/500aa169fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/500aa169fd3d00151c31fb33fff4337f deleted file mode 100644 index d2b76a1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/500aa169fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50775507fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50775507fd3d00151c31fb33fff4337f deleted file mode 100644 index a5f989f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50775507fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,24 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - if(!AllPlayers.containsKey(arg0)(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c0c10ce46b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c0c10ce46b3f00151fb6edb183f9215c deleted file mode 100644 index a5fd974..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c0c10ce46b3f00151fb6edb183f9215c +++ /dev/null @@ -1,287 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } - catch (IOException e) - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/d05bd96d083e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/d05bd96d083e00151c31fb33fff4337f deleted file mode 100644 index abdc7d1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/d05bd96d083e00151c31fb33fff4337f +++ /dev/null @@ -1,26 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public boolean HasFlair; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b03cb8c36b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b03cb8c36b3f00151fb6edb183f9215c deleted file mode 100644 index c4da390..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b03cb8c36b3f00151fb6edb183f9215c +++ /dev/null @@ -1,285 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - } catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/609f275f313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/c/609f275f313e00151cbdba8b5f0a340e deleted file mode 100644 index 0473087..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c/609f275f313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player player : PluginMain.GetPlayers()) - { - - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/b022c7a5213f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/c/b022c7a5213f00151fb6edb183f9215c deleted file mode 100644 index dc0378b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c/b022c7a5213f00151fb6edb183f9215c +++ /dev/null @@ -1,71 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - /*for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), ) - }*/ - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - PluginMain.LastException=e; //2015.08.09. - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/b0b29cfe313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/b0b29cfe313e00151cbdba8b5f0a340e deleted file mode 100644 index 2ade719..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/b0b29cfe313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), p.getDisplayName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e08d9071fc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e08d9071fc3d00151c31fb33fff4337f deleted file mode 100644 index 9e3f840..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e08d9071fc3d00151c31fb33fff4337f +++ /dev/null @@ -1,14 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static ArrayList AllPlayers=new ArrayList<>(); //2015.08.08. -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50682add833e00151ce8ff6d4f74dabd b/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50682add833e00151ce8ff6d4f74dabd deleted file mode 100644 index 1529757..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50682add833e00151ce8ff6d4f74dabd +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), ) - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/b027ea9c6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/b027ea9c6b3f00151fb6edb183f9215c deleted file mode 100644 index e7c29f1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/b027ea9c6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,277 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - String URL="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(URL, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/b03944c06d3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/b03944c06d3f00151fb6edb183f9215c deleted file mode 100644 index 43374bc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/b03944c06d3f00151fb6edb183f9215c +++ /dev/null @@ -1,293 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - case "opme": - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/50fc0176fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/50fc0176fd3d00151c31fb33fff4337f deleted file mode 100644 index 6913c61..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/50fc0176fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,27 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername);> - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40969eebfc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40969eebfc3d00151c31fb33fff4337f deleted file mode 100644 index fbd73ba..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40969eebfc3d00151c31fb33fff4337f +++ /dev/null @@ -1,19 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - AllPlayers.put(playername, new MaybeOfflinePlayer()); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/d0e5e980a03e00151ce8ff6d4f74dabd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/d0e5e980a03e00151ce8ff6d4f74dabd deleted file mode 100644 index 14ace19..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/d0e5e980a03e00151ce8ff6d4f74dabd +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - /*for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - message.replaceAll(p.getName(), ) - }*/ - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/60556449313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/60556449313e00151cbdba8b5f0a340e deleted file mode 100644 index 3787dd7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/60556449313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,67 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d6/d059d3b7fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/d6/d059d3b7fd3d00151c31fb33fff4337f deleted file mode 100644 index 3c5dbca..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d6/d059d3b7fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06d9fe5f93d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06d9fe5f93d00151c31fb33fff4337f deleted file mode 100644 index 476dd34..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06d9fe5f93d00151c31fb33fff4337f +++ /dev/null @@ -1,5 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/305eeba36b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/305eeba36b3f00151fb6edb183f9215c deleted file mode 100644 index ce1a21d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/305eeba36b3f00151fb6edb183f9215c +++ /dev/null @@ -1,277 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/30852a8e6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/30852a8e6b3f00151fb6edb183f9215c deleted file mode 100644 index 2083d79..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/30852a8e6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,277 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - String URL="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"; - FileUtils.copyURLToFile(URL, "plugins/TheButtonAutoFlair.jar"); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/db/d0069951053e00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/db/d0069951053e00151c31fb33fff4337f deleted file mode 100644 index abdc7d1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/db/d0069951053e00151c31fb33fff4337f +++ /dev/null @@ -1,26 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String DisplayName; - public boolean HasFlair; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/500da46afb3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/de/500da46afb3d00151c31fb33fff4337f deleted file mode 100644 index 5f100a3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/de/500da46afb3d00151c31fb33fff4337f +++ /dev/null @@ -1,11 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/d037d008fa3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/de/d037d008fa3d00151c31fb33fff4337f deleted file mode 100644 index a948ff8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/de/d037d008fa3d00151c31fb33fff4337f +++ /dev/null @@ -1,9 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String UserName; - String Flair; - boolean AcceptedFlair; - boolean IgnoredFlair; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b07ff7bc6d3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b07ff7bc6d3f00151fb6edb183f9215c deleted file mode 100644 index 0c6f200..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b07ff7bc6d3f00151fb6edb183f9215c +++ /dev/null @@ -1,291 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - SendMessage(player, "Updating done!"); - } - catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/d020d619fa3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/d020d619fa3d00151c31fb33fff4337f deleted file mode 100644 index 8f85bbd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/d020d619fa3d00151c31fb33fff4337f +++ /dev/null @@ -1,10 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - String PlayerName; - String UserName; - String Flair; - boolean AcceptedFlair; - boolean IgnoredFlair; - String TownColors; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/602ab6bd313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/602ab6bd313e00151cbdba8b5f0a340e deleted file mode 100644 index 8938516..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/602ab6bd313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,71 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index=0; - index = message.indexOf(p.getName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60215032313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60215032313e00151cbdba8b5f0a340e deleted file mode 100644 index ac13911..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60215032313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,66 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message= - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+event.getMessage()); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60f9a9af313e00151cbdba8b5f0a340e b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60f9a9af313e00151cbdba8b5f0a340e deleted file mode 100644 index 2fd48b2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60f9a9af313e00151cbdba8b5f0a340e +++ /dev/null @@ -1,70 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.inventivegames.TellRawAutoMessage.Reflection; - -public class PlayerListener implements Listener -{ //2015.07.16. - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p=event.getPlayer(); - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) - PluginMain.AppendPlayerDisplayFlair(p, mp.UserName, mp.Flair); - else - { //2015.07.20. - String json="[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your Minecraft name to \"},{\"text\":\"[this thread.]\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread§r\"}]}}}]"; - sendRawMessage(p, json); - } - } - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent event) - { - } - - @EventHandler - public void onPlayerChat(AsyncPlayerChatEvent event) - { - MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); - String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. - String message=event.getMessage(); //2015.08.08. - for(Player p : PluginMain.GetPlayers()) - { //2015.08.08. - int index = message.indexOf(p.getName()); - } - event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. - } - - private static Class nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection.getNMSClass("PacketPlayOutChat"); - public static void sendRawMessage(Player player, String message) - { - try { - System.out.println("1"); - Object handle = Reflection.getHandle(player); - System.out.println("2"); - Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); - System.out.println("3"); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); - System.out.println("4"); - Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); - System.out.println("5"); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); - System.out.println("6"); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/d06d6706fd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/d06d6706fd3d00151c31fb33fff4337f deleted file mode 100644 index ec14e74..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/d06d6706fd3d00151c31fb33fff4337f +++ /dev/null @@ -1,24 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - if(!AllPlayers.contains(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/c0d3c395fc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/c0d3c395fc3d00151c31fb33fff4337f deleted file mode 100644 index 455b8df..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/c0d3c395fc3d00151c31fb33fff4337f +++ /dev/null @@ -1,19 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String username) - { - - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f0/d01b9bcffc3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/d01b9bcffc3d00151c31fb33fff4337f deleted file mode 100644 index 6737bc4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f0/d01b9bcffc3d00151c31fb33fff4337f +++ /dev/null @@ -1,19 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer { - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b00a25cf6b3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b00a25cf6b3f00151fb6edb183f9215c deleted file mode 100644 index 2417340..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b00a25cf6b3f00151fb6edb183f9215c +++ /dev/null @@ -1,284 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class Commands implements CommandExecutor { - // This method is called, when somebody uses our command - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - if(args.length<1) - return false; - MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. - //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) - { - player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft"); - return true; - } - switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09. - { - case "accept": - { - if(p.IgnoredFlair) - p.IgnoredFlair=false; //2015.08.08. - if(!p.AcceptedFlair) - { - String flair=p.Flair; //2015.08.08. - //PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20. - p.AcceptedFlair=true; //2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§6Your flair has been set:§r "+flair); - } - else - player.sendMessage("§cYou already have this user's flair.§r"); - break; - } - case "ignore": - { - if(p.AcceptedFlair) - p.AcceptedFlair=false; //2015.08.08. - if(!p.IgnoredFlair) - { - p.IgnoredFlair=true; - //String flair=p.Flair; //2015.08.08. - //PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20. - player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r"); - } - else - player.sendMessage("§cYou already ignored this request.§r"); - break; - } - /*case "reload": //2015.07.20. - DoReload(player); - break;*/ - case "admin": //2015.08.09. - DoAdmin(player, args); - break; - case "nonpresser": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); - break; - case "cantpress": //2015.08.09. - if(!p.AcceptedFlair) - { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if(p.FlairDecided) - { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); - break; - default: - return false; - } - return true; - } - /*if(args[0].toLowerCase()=="reload") - DoReload(null); //2015.07.20.*/ - else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09. - { - DoAdmin(null, args); //2015.08.09. - return true; //2015.08.09. - } - return false; - } - private static void DoReload(Player player) - { //2015.07.20. - //if(player==null || player.isOp() || player.getName()=="NorbiPeti") - //{ - try - { - File file=new File("autoflairconfig.txt"); - if(file.exists()) - { - PluginMain.LoadFiles(true); //2015.08.09. - for(Player p : PluginMain.GetPlayers()) - { - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) - { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); - PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. - } - String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. - p.sendMessage(msg); //2015.08.09. - } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. - } - } - catch(Exception e) - { - System.out.println("Error!\n"+e); - if(player!=null) - player.sendMessage("§cAn error occured. See console for details.§r"); - PluginMain.LastException=e; //2015.08.09. - } - //} - //else - //player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static Player ReloadPlayer; //2015.08.09. - private static void DoAdmin(Player player, String[] args) - { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") - { - //System.out.println("Args length: " + args.length); - if(args.length==1) - { - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - //args[0] is "admin" - switch(args[1].toLowerCase()) - { - case "reload": - ReloadPlayer=player; //2015.08.09. - SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); - break; - case "playerinfo": - DoPlayerInfo(player, args); - break; - case "getlasterror": - DoGetLastError(player, args); - break; //<-- 2015.08.10. - case "confirm": - if(ReloadPlayer==player) - DoReload(player); //2015.08.09. - else - SendMessage(player, "§cYou need to do /u admin reload first.§r"); - break; - case "save": - PluginMain.SaveFiles(); //2015.08.09. - SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r"); - break; - case "setflair": - DoSetFlair(player, args); - break; - case "updateplugin": //2015.08.10. - DoUpdatePlugin(player); - break; - default: - String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r"; - SendMessage(player, message); - return; - } - } - else - player.sendMessage("§cYou need to be OP to use this command.§r"); - } - private static void DoPlayerInfo(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "playerinfo" - if(args.length==2) - { - String message="§cUsage: /u admin playerinfo §r"; - SendMessage(player, message); - return; - } - if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2])) - { - String message="§cPlayer not found: "+args[2]+"§r"; - SendMessage(player, message); - return; - } - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]); - SendMessage(player, "Player name: "+p.PlayerName); - SendMessage(player, "User flair: "+p.Flair); - SendMessage(player, "Username: "+p.UserName); - SendMessage(player, "Flair accepted: "+p.AcceptedFlair); - SendMessage(player, "Flair ignored: "+p.IgnoredFlair); - } - private static void SendMessage(Player player, String message) - { //2015.08.09. - if(player==null) - System.out.println(message); - else - player.sendMessage(message); - } - private static void DoGetLastError(Player player, String[] args) - { //2015.08.09. - //args[0] is "admin" - args[1] is "getlasterror" - if(PluginMain.LastException!=null) - { - SendMessage(player, "Last error:"); - SendMessage(player, PluginMain.LastException.toString()); - PluginMain.LastException=null; - } - else - SendMessage(player, "There were no exceptions."); - } - private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair) - { //2015.08.09. - flair=flair.replace('&', '§'); - targetplayer.Flair=flair; - if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) - { - SendMessage(player, "§cError removing previous custom flair!§r"); - return; - } - File file=new File("customflairs.txt"); - try { - BufferedWriter bw; - bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); - bw.close(); - } catch (IOException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } - SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r"); - } - private static void DoSetFlair(Player player, String[] args) - { - //args[0] is "admin" - args[1] is "setflair" - if(args.length<4) - { - SendMessage(player, "§cUsage: /u admin setflair "); - return; - } - SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); - } - private static void DoUpdatePlugin(Player player) - { //2015.08.10. - SendMessage(player, "Updating Auto-Flair plugin..."); - System.out.println("Forced updating of Auto-Flair plugin..."); - URL url; - try { - url = new URL("https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar"); - FileUtils.copyURLToFile(url, new File("plugins/TheButtonAutoFlair.jar")); - } catch (MalformedURLException e) { - System.out.println("Error!\n"+e); - PluginMain.LastException=e; //2015.08.09. - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/d0a2d21dfa3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/d0a2d21dfa3d00151c31fb33fff4337f deleted file mode 100644 index e3c8c26..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/d0a2d21dfa3d00151c31fb33fff4337f +++ /dev/null @@ -1,11 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -public class MaybeOfflinePlayer { - public String PlayerName; - String UserName; - String Flair; - boolean AcceptedFlair; - boolean IgnoredFlair; - String TownColors; - String DisplayName; -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/303fdacd3f3f00151fb6edb183f9215c b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/303fdacd3f3f00151fb6edb183f9215c deleted file mode 100644 index 8206839..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/303fdacd3f3f00151fb6edb183f9215c +++ /dev/null @@ -1,31 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; //If the user comments their name, it gets set, it doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public boolean FlairDecided; //2015.08.09. - private static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - return player; - } - return AllPlayers.get(playername); - } - /*public enum FlairClassType - { //2015.08.09. - NonPresser, - CantPress, - Undecided - }*/ -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/d034285bfd3d00151c31fb33fff4337f b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/d034285bfd3d00151c31fb33fff4337f deleted file mode 100644 index 8538c44..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/d034285bfd3d00151c31fb33fff4337f +++ /dev/null @@ -1,25 +0,0 @@ -package tk.sznp.thebuttonautoflair; - -import java.util.ArrayList; -import java.util.HashMap; - -public class MaybeOfflinePlayer -{ //2015.08.08. - public String PlayerName; - public String UserName; - public String Flair; - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public String TownColors; - public String DisplayName; - public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. - public static void AddPlayer(String playername) - { - if(!AllPlayers.containsKey(playername)) - { - MaybeOfflinePlayer player=new MaybeOfflinePlayer(); - player.PlayerName=playername; - AllPlayers.put(playername, player); - } - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index index fb8c86793c32bd56f358171be80005fbeb443322..1fe6b56c4647deb61cf911e31c4d412dcc433245 100644 GIT binary patch literal 4440 zcmajiYfw~W7zgm9HdBdc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5E$^HF^1bR|4&B!yu zwxQ>*ATNszQKFlPj4A)CR2L6DXM8wM3w?lo(~4YO`_3Ko(sm=ZM-f=xihgrFd6~ug z&FEdJ@hykYcgB;uFX=2o&krG21!U)= zANJ>Z#y!YGH*4+xm;QTqU+4TCx+I(PsZ-O@1GbSfZ@h8|Bq?!X=^T+*N>{GQYRjWv zo`li8CB2Rv#hQ4P2>soSr&$*`EqsKd^6;f!Cg_){l6gI>fl>M3G`TS3tq%0a63#8R z-9@jOT*UV9cGMQ;Lr-9N7dwiDTlW^A^PK0fuDM>ddoARDv>QS(_>ow;y)4fHRrp))$Kc-cHWqdP>Z*)ywp=J%t~Jr|J+o;|Tg zS1cgc?OA8w!Jm=~T`dg!cIYX#pBZwY3D3}vduv#CFS@5jm%Sj@h(gp>f3&voyU-O`Iq$Q6!L$D%)6^&y*A%xbxcN2cCTa+xx%1^sLwxz1+#@959Ahp;`oSykoe YrGezK>#hgUbDhZ*)@l3Ei_FRY2a5GHBLDyZ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/history.index index 1a40c36496fa26d984c156fef63830f509a734ab..339747bc67c966c69160a4481561b3f6e7e2afe5 100644 GIT binary patch delta 26 hcmXSM5n*CrU|?k6)-T8@P0!5JtIW+|V45gm002c=1@Hg> delta 75 zcmZ=M5n*CrU|?k6)-T8@P0!5JtIW+|V3{alVBnz1{CJxSgQ%GK-j|uBhs+Mn;g|4d bWMDA(8}v2Tos{h%XPQL!b;52zPi|OQeMsZdKIVJ|Z$sd@+CLdwaWL!7-9n)UM zfXQo^jTl`g-)Gimw4BV(GMk+N1jH6hu3)rDR&ZkADJ@Pda!tuBNleN~Wn^GrPtHgz za?ML&Vqj1xU|`BjVNzgVJjB4Bn_66)n4Zeapcmrr;;)dIrV)@|oLQ2YpI59`oLQBs zp=oEEoS&0lRIHbinwMUZp{Y=CQo89 z7iajyz`*FQd*te21~3pg&IqI#C(mM5U{X528OWoGd70ZJ((6{RL-7vyK=l~|z~ ztPl;-YNcRg6sw@Cke>&U^#ZEYKrmg)Qu9hQ86@+I()Ci4b21BxQ}t3(C;wyeV$_`M R$t){^;#6Qj^S#nz0|4r2f7$>5 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources index 34874941c57670d7393230c0baabb4dd7d9e6a19..c2da8ad1c6ee0d113a8d5b5d26211eac9a4dca08 100644 GIT binary patch delta 127 zcmX?>_?UNcfvh&Gk)f55*+v6BCN2{L14AQYOCv+$$&4aWllRMCXEdLDk}+ NNCkfGsoq_F3;^L^CW-(6 literal 12486 zcmeI2F>ljA6vvq(Wn*GMmLgVjcRr`_Ns)@6BLgZDZ0H(agM(v7_NAp_VulTgFTf{Y zZiSfoRrmlMSvbdbT3fxdQx}QQCwY8&e)oJo|KGcNyWc;39Gu;||KQQrU*Ep`csQ8z zREors{2&zl-e8|g>&bFzVb?;4p%HV4^>lClr9}{S`@Kmhc=AkylD~LXX|n~#)Oq&X326rgfT&6q)k>OzvcvF*_x%Ld$Vm8bjX*{4S#7Ay`LeqN|~ zS)oP|bMSU>)2#d;I2{fn?iM)1es9x4tp<+Es0ZM{DW2|B_CKxEI)md<=1>3!zyWZY zj +content_assist_lru_history= content_assist_number_of_computers=21 content_assist_proposals_background=255,255,255 content_assist_proposals_foreground=0,0,0 diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index 76af5c8..d4bae74 100644 --- a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -240,20 +240,20 @@ org.eclipse.e4.primaryDataStack EditorStack - + Editor org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide activeOnClose - + Editor org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide - + Editor org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide @@ -264,10 +264,10 @@ org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide - - + + Editor - org.eclipse.ui.DefaultTextEditor + org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide @@ -324,7 +324,7 @@ categoryTag:General - + View categoryTag:General @@ -426,18 +426,18 @@ Draggable - - - - - - - - - - - - + + + + + + + + + + + + toolbarSeparator @@ -445,38 +445,38 @@ Draggable - - - + + + Draggable - - + + Draggable - - + + Draggable - - + + Draggable - - - - + + + + Draggable - - - - + + + + Draggable @@ -486,20 +486,20 @@ Draggable - - - - + + + + Draggable - - - - - - - + + + + + + + Draggable @@ -517,15 +517,15 @@ Draggable - - - - - - - - - + + + + + + + + + toolbarSeparator @@ -537,8 +537,8 @@ Draggable - - + + stretch diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index b/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index index 82d3d365a7508d160e9bee24714060c10f7c2c4d..1646ae2870e0de279022597f1d03d72b44fb863f 100644 GIT binary patch literal 18476 zcma)ETX!7Cajw1ZEOv1tD9KcOOk2L{&|FgTiS0yj4hTXNY!ILTP;!prlMHqTz>vE$ ztC?Mb(3A3-hy0iPfV}5#Bu_a9AVd<7LBf)lud2FdW-lbg2VrNXySlpWRb4H*u(Eb@ z`Hz=BS>D)OSzo(+{p$7i{+8(0zteBxsMTzHO+R?x1%3a4x9fJjxVhzZIvei(;-DYi z_Tt#x^_m;rPRDEY{V=$C&wbz)OH>b|-R8YG44O+fSEox<3d8%pccDbZRX^@G@b{yw ztvhois%(Y#y}*m`%K81~`r2X?xd(XfEI({{JqC$~{Owizx4gc653BI6&3@zuyKmx) z7tK|uBtY<^_-W)b^y-}`?0HfD0KW@=yuCV`E(GM>?cZ<4p9j5Wf6v<<^!s7pVlz7( z*N>WuK@bjtmKSa9MV{OK0bnhK-L4z7WBi`K?H+7<>pMFgKk)8!+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reku9%)o9WcVA+@h!;Y(og9py!83XL8;I&TyzY<%e|GuwGDj_zdpiW7+TmEycK7U z6m2Wia(q9CC5a5_#?yxXqe93(8tAdn&&T}Tyb<7_w{~g+k=aK*b diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml index ce5d0e5..62009c4 100644 --- a/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml +++ b/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -1,7 +1,5 @@ - - @@ -28,7 +26,6 @@ - @@ -44,8 +41,6 @@ - - @@ -59,5 +54,10 @@ + + + + + diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml index 8328181..c04db39 100644 --- a/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml +++ b/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -12,6 +12,8 @@ +
+
diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class index 20a3dc965eb5e1b1f511bf35c27db9bf39bdb395..244362e8df3da267ac180fbeba37ef9907879ef9 100644 GIT binary patch literal 13018 zcmb7L31C#!)jsFVWacG#VM$~e5P5)vY$ON>I6)8sXfz3100B`aGcU=&WG2o`2(i?< z;EL8=3$>_d9d`vJ1hG`86>Zhlr7pEvtJZ3_zqMKwm;B$k?@cx$ZLQ|sci(;Yo_p>& z-}%nH(_eh^_erGG#O5|mD%sgnLIPY(QtAWldGU`Ig`607P7L)ML7m#QWn#|s&Le* zX=$pn;md1)-uV70QI;}~>2jmKVL1g89g9v|B_Qr>esr%9GJ!Jq;v#E7DGn1B^p7+qq8 zLSYQUtFow=CVHu)m(kg}G^kWW&Q8XvVy#xZB9O3jn#7b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j?NQjOfAg14vZJgbs-Bn${MnD|WIhk!XzsXX#c+dzCKnxQ5T7C(BKdMwL!>4K6Co;)Y&=BSy6tO1Et1i#{ehiIIU} z+1=tF69X^T6E7oj0~z;{QBPoA>xF@5JX6g;jS2qZf3Z7ACuO67z1_{`xN`~?00 delta 23 ecmZ3^x}0@`4ilsLWL+kER!s(W2Cd13OlAN>-vs*r diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class index 4d9a83e994b8e7fc67f3254f9c7d4c0715fb2711..2591e3c3ffff67d454846d5fe9c06cf37f710c97 100644 GIT binary patch literal 15142 zcmb_j34B!5)j#KEGH)_@VMziKSsWH2D}g8o35#seKoWK^xZostNhVBY;>-kyYZu(H zi>+E{t5~Juf*arvOtlo-QkQCNwXN1x`*mNeOKV$O3*Z0T_hvF#r1E!W|v{P;w0oUmOM%e+Zp9wf<;q z+4d%@GZqMkm`0_IN;PAgcU^c}Xh}F2jzpP;+k?7dfna%^zZ2bAYXhwzf2=Elwax0^ zJ1>pm+E^qIYONaFvH&zjEDD9fU0_L_6^;5^EllLBMo+XT67hG}2BI+xElQgr)jq^T zLe@-@T^H!U>bM5XpVt%&gaWYzOc{km8^EF^;bzOA)0swUCg};!_ea~XJ1-T`IFrWH zX-w{U`n4=#I>V$K8fMT$aJKKA)MC8kqj55Bib*3WH-mC|_egb`N%=HNSQrRd^<5o} zR%D&OQI0gXHr(V7ZtzC}QrC@M%Aj#xDy8WLl_l4fet;&G(+tSPR)4U|TG_%hx^R=j zoAhB-GINDVS>(lDV{HMj))Njb3&~7bG@IrabPf)nPe9goM`KopNpqu&R!}Xr4pelpvA&@6kVSl$35y`beR>Vtn zG%lM~(^`YpK#bB>GZcA~*3o*VVG*lU2t<}`wL&o*-<-m91hAyFJUK;GdRIT9RYe;- zv=K_sCERN;X%k%t-Nwcp&|sQ96tmL_Ceg;`g7Y4@a530*5-vCcq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RPH@gj9vLWITL&y&xC`j zZw{?blYG6CHD4#m^(T{@dIHHYLeF*eLN*KjJ3W7Tm1jCv8PvJTloMBx;fTdDtmjPF ztA+^i1IoWwjTRzuEDEk=T#`cPXPi2aCJ zM_}YA{7CpL1YV;N;f_I2HX1)^Ev02#2Iw3M`zxguPzvLXeH)KQ)I5Q%=81FzzBdE7 zZ{sQW9oST4c$4XIo=*D^(I4g+^bF6WS9vzQ&U5H3o=bn^dH9{lY|cTfZtx;5!eFOF#!S82RU?{ymPPysfi>Ai*ExPwRH z6iR7BmC)lX=FWEucToK@u@_$~Yb(?Jk*1@OZI zah4xalN=nFvaBqnrs}Ggvr~nVF6)xImSs}cGNi7Z(6a21ng&dnw4uziUsdl{GwTG6 z)Epf<)hB5}g&R3-lDPfoE=kviYX38KpPKKa*Z?5M`J~jM3O9&)p**E(JCWz}Epzzu zE%P5XE7>{8B@f_yCKqtejAd@6ArNINTttL=ag+ukcpHlM_7NPzFX!VJy%pBDjW+Oh zI*)fCAHIlo@Wpg7UxEN|JA%DS>3-zNkMWlgv|Ub5^A)hTtLPYCjUU2YL&y1YoZz)s z^E&(l>Uti{H*gv9X>kpbjulXmTB??zHp0zdrTuAb9|XVrgsM}^aquxZOM7HRucu4M zsvWI!d}f%u0m(l*s0^7ZbWcqKeVz0cr5g-JjHR0frkk8GQ#;_C+*zj_)S+FVtB|T* zNlpisri$UxBnf>^4!aB(yWBbTl_=ID$Ngj%<$89f0e7t9DXKkbwX4{#Rzd5kbIT>5 zM6Upw?#e4yiF*UbXRT$6;SCR8Q&!6#(vY zc2Q4!&Ref5yFI(BJzWe#a%%Td$LE1*TuFd@p_~e; 0 && args[0].toLowerCase().equals("announce")) { + DoAnnounce(null, args); + return true; } return false; } @@ -296,4 +304,138 @@ public class Commands implements CommandExecutor { PluginMain.LastException = e; // 2015.08.09. } } + + private static void DoAnnounce(Player player, String[] args) { + if (player == null || player.isOp() + || player.getName().equals("NorbiPeti")) { + if (args.length == 1) { + String message = "§cUsage: /u announce add|remove|settime|list§r"; + SendMessage(player, message); + return; + } + // args[0] is "announce" + switch (args[1].toLowerCase()) { + case "add": + if (args.length < 3) { + SendMessage(player, "§cUsage: /u announce add "); + return; + } + // PluginMain.AnnounceMessages.add(args[2]); + File file = new File("announcemessages.txt"); + try { + BufferedWriter bw; + bw = new BufferedWriter(new FileWriter(file, true)); + // bw.write(args[2] + "\n"); + StringBuilder sb = new StringBuilder(); + for (int i = 2; i < args.length; i++) { + sb.append(args[i]); + if (i != args.length - 1) + sb.append(" "); + } + String finalmessage=sb.toString().replace('&', '§'); + PluginMain.AnnounceMessages.add(finalmessage); + bw.write(finalmessage); + bw.write(System.lineSeparator()); + bw.close(); + SendMessage(player, "§bAnnouncement added.§r"); + } catch (IOException e) { + System.out.println("Error!\n" + e); + PluginMain.LastException = e; // 2015.08.09. + } + break; + case "remove": + if (args.length < 3) { + SendMessage(player, "§cUsage: /u announce remove "); + return; + } + try { + if (!PluginMain.RemoveLineFromFile("announcemessages.txt", + Integer.parseInt(args[2]) + 1)) { + SendMessage(player, + "§cError removing announce message!§r"); + return; + } else { + PluginMain.AnnounceMessages.remove(Integer + .parseInt(args[2])); + SendMessage(player, "§bAnnouncement removed.§r"); + } + } catch (NumberFormatException e) { + SendMessage(player, "§cUsage: /u announce remove §r"); + return; + } + break; + case "settime": + if (args.length < 3) { + SendMessage(player, + "§cUsage: /u announce settime "); + return; + } + SendMessage(player, "Setting time between messages..."); + PluginMain.AnnounceTime = Integer.parseInt(args[2]) * 60 * 1000; + File inputFile = new File("announcemessages.txt"); + File tempFile = new File("_tempAnnounce.txt"); + + if (!inputFile.exists()) + break; + + try { + BufferedReader reader = new BufferedReader(new FileReader( + inputFile)); + BufferedWriter writer = new BufferedWriter(new FileWriter( + tempFile)); + + String currentLine; + + boolean first = true; + while ((currentLine = reader.readLine()) != null) { + if (first) { + writer.write(PluginMain.AnnounceTime + + System.lineSeparator()); + first = false; + } else { + writer.write(currentLine + + System.getProperty("line.separator")); + } + } + writer.close(); + reader.close(); + if (!tempFile.renameTo(inputFile)) { + inputFile.delete(); + if (tempFile.renameTo(inputFile)) { + SendMessage(player, + "Setting time between messages done!"); + break; + } else { + SendMessage(player, + "§cError: Failed to rename file!"); + break; + } + } else { + SendMessage(player, + "Setting time between messages done!"); + break; + } + } catch (IOException e) { + System.out.println("Error!\n" + e); + PluginMain.LastException = e; // 2015.08.09. + } + break; + case "list": + SendMessage(player, "§bList of announce messages:§r"); + SendMessage(player, "§bFormat: [index] message§r"); + int i = 0; + for (String message : PluginMain.AnnounceMessages) + SendMessage(player, "[" + i++ + "] " + message); + SendMessage(player, + "§bCurrent wait time between announcements: " + + PluginMain.AnnounceTime / 60 / 1000 + + " minute(s)§r"); + break; + default: + String message = "§cUsage: /u announce add|remove|settime|list§r"; + SendMessage(player, message); + return; + } + } + } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index 5fc2f5c..e1aa9bd 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -14,6 +14,7 @@ import java.lang.String; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -21,7 +22,7 @@ import java.util.Map; public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. // A user, which flair isn't obtainable: // https://www.reddit.com/r/thebutton/comments/31c32v/i_pressed_the_button_without_really_thinking/ - private static PluginMain Instance; + public static PluginMain Instance; public static ConsoleCommandSender Console; // 2015.08.12. // Fired when plugin is first enabled @@ -43,9 +44,16 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. }; Thread t = new Thread(r); t.start(); + r = new Runnable() { + public void run() { + AnnouncerThread.Run(); + } + }; + t = new Thread(r); + t.start(); } - Boolean stop = false; + public Boolean stop = false; // Fired when plugin is disabled @Override @@ -108,7 +116,11 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. flairclass = "unknown"; SetFlair(ign, flair, flairclass, author); } - Thread.sleep(10000); + try { + Thread.sleep(10000); + } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); + } } catch (Exception e) { System.out.println("Error!\n" + e); LastException = e; // 2015.08.09. @@ -279,6 +291,9 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. return Instance.getServer().getOnlinePlayers(); } + public static ArrayList AnnounceMessages = new ArrayList<>(); + public static int AnnounceTime = 15 * 60 * 1000; + public static void LoadFiles(boolean reload) // <-- 2015.08.09. { if (reload) { // 2015.08.09. @@ -286,6 +301,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. .println("The Button Minecraft plugin cleanup for reloading..."); MaybeOfflinePlayer.AllPlayers.clear(); TownColors.clear(); + AnnounceMessages.clear(); } System.out.println("Loading files for The Button Minecraft plugin..."); // 2015.08.09. try { @@ -350,7 +366,31 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. PlayerListener.NotificationPitch = Float.parseFloat(split[1]); br.close(); } - // throw new IOException("Test"); //2015.08.09. + file = new File("announcemessages.txt"); // 2015.08.09. + if (file.exists()) { + BufferedReader br = new BufferedReader(new FileReader(file)); + String line; + boolean first = true; + while ((line = br.readLine()) != null) { + if (first) { + AnnounceTime = Integer.parseInt(line.trim()); + first = false; + } else + AnnounceMessages.add(line.trim()); + } + br.close(); + } else { + // Write time + try { + BufferedWriter bw; + bw = new BufferedWriter(new FileWriter(file)); + bw.write(AnnounceTime + "\n"); + bw.close(); + } catch (IOException e) { + System.out.println("Error!\n" + e); + PluginMain.LastException = e; // 2015.08.09. + } + } System.out.println("The Button Minecraft plugin loaded files!"); } catch (IOException e) { System.out.println("Error!\n" + e); @@ -432,4 +472,38 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. } return false; } + + public static boolean RemoveLineFromFile(String file, int index) { + File inputFile = new File(file); + File tempFile = new File("_temp2.txt"); + + if (!inputFile.exists()) + return true; // 2015.08.10. + + try { + BufferedReader reader = new BufferedReader( + new FileReader(inputFile)); + BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); + + String currentLine; + int i = 0; + + while ((currentLine = reader.readLine()) != null) { + if (i++ == index) + continue; + writer.write(currentLine + System.getProperty("line.separator")); + } + writer.close(); + reader.close(); + if (!tempFile.renameTo(inputFile)) { + inputFile.delete(); + return tempFile.renameTo(inputFile); + } else + return true; + } catch (IOException e) { + System.out.println("Error!\n" + e); + LastException = e; // 2015.08.09. + } + return false; + } }