Skip to content

Commit

Permalink
Fix up legacy code to use new interfaces
Browse files Browse the repository at this point in the history
This took way more time than it was worth.
Converted line endings to Unix, some other trivial crap.
Thanks to Phoenix616 for already having a multi-version pom, it would have taken me much longer to figure out without a functional example.

The only legacy code which is not supported is that of the pre-versioned package era. I compiled a copy of Craftbukkit about 15 commits prior to the introduction of versioned packages, and NMS had already been fiddled with. Anyone who needs support for builds in that range can use an older OpenInv build instead, it's not like UUIDs are a big concern.
  • Loading branch information
Jikoo committed Mar 4, 2016
1 parent d761b6b commit fb48f6a
Show file tree
Hide file tree
Showing 110 changed files with 10,717 additions and 662 deletions.
3 changes: 0 additions & 3 deletions .settings/org.eclipse.ltk.core.refactoring.prefs

This file was deleted.

50 changes: 25 additions & 25 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
## Goals
This fork of OpenInv was created when the lag caused by offline player lookups post-UUID migration became too much to bear. Overall, it does not differ much from the original.

### Changes of Note
- Removed updater
- Removed wand

## Previous Versions
Any version of Minecraft this fork has been existent for should have a [release](https://github.com/Jikoo/OpenInv/releases) tagged. Features are not backported, however.

## License
```
Copyright (C) 2011-2014 lishid. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
## Goals
This fork of OpenInv was created when the lag caused by offline player lookups post-UUID migration became too much to bear. Overall, it does not differ much from the original.

### Changes of Note
- Removed updater
- Removed wand

## Previous Versions
Any version of Minecraft this fork has been existent for should have a [release](https://github.com/Jikoo/OpenInv/releases) tagged. Features are not backported, however.

## License
```
Copyright (C) 2011-2014 lishid. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
167 changes: 140 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,141 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>OpenInv</groupId>
<artifactId>OpenInv</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>OpenInv</groupId>
<artifactId>OpenInv</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_9_R1</classifier>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_8_R3</classifier>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_8_R2</classifier>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_8_R1</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_7_R4</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.7.9-R0.2-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_7_R3</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.7.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_7_R2</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.7.2-R0.4-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_7_R1</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.4-R2.0-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_6_R3</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.2-R1.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_6_R2</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_6_R1</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R1.0-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_5_R3</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_5_R2</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_5_R1</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.4.7-R1.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_4_R1</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.4.6-R0.4-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_4_6</classifier>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.4.5-R1.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>v1_4_5</classifier>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion src/main/java/com/lishid/openinv/OpenInv.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,4 @@ public static boolean hasPermission(Permissible player, String permission) {
}
return player.hasPermission(permission);
}
}
}
100 changes: 50 additions & 50 deletions src/main/java/com/lishid/openinv/OpenInvInventoryListener.java
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
/*
* Copyright (C) 2011-2014 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lishid.openinv;

import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;

public class OpenInvInventoryListener implements Listener {

private final OpenInv plugin;

public OpenInvInventoryListener(OpenInv plugin) {
this.plugin = plugin;
}

@EventHandler(priority = EventPriority.NORMAL)
public void onInventoryClick(InventoryClickEvent event) {
// If this is the top inventory
// if (event.getView().convertSlot(event.getRawSlot()) == event.getRawSlot())
// {
if (!plugin.getInventoryAccess().check(event.getInventory(), event.getWhoClicked())) {
event.setCancelled(true);
}
// }
}

@EventHandler(priority = EventPriority.NORMAL)
public void onInventoryDrag(InventoryDragEvent event) {
if (!plugin.getInventoryAccess().check(event.getInventory(), event.getWhoClicked())) {
event.setCancelled(true);
}
}
}
/*
* Copyright (C) 2011-2014 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lishid.openinv;

import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;

public class OpenInvInventoryListener implements Listener {

private final OpenInv plugin;

public OpenInvInventoryListener(OpenInv plugin) {
this.plugin = plugin;
}

@EventHandler(priority = EventPriority.NORMAL)
public void onInventoryClick(InventoryClickEvent event) {
// If this is the top inventory
// if (event.getView().convertSlot(event.getRawSlot()) == event.getRawSlot())
// {
if (!plugin.getInventoryAccess().check(event.getInventory(), event.getWhoClicked())) {
event.setCancelled(true);
}
// }
}

@EventHandler(priority = EventPriority.NORMAL)
public void onInventoryDrag(InventoryDragEvent event) {
if (!plugin.getInventoryAccess().check(event.getInventory(), event.getWhoClicked())) {
event.setCancelled(true);
}
}
}
Loading

0 comments on commit fb48f6a

Please sign in to comment.